toDescription method Null safety

  1. @override
String toDescription(
  1. {TextTreeConfiguration? parentConfiguration}
)
override

Returns a description with a short summary of the node itself not including children or properties.

parentConfiguration specifies how the parent is rendered as text art. For example, if the parent does not line break between properties, the description of a property should also be a single line if possible.

Implementation

@override
String toDescription({ TextTreeConfiguration? parentConfiguration }) {
  if (_description != null) {
    return _addTooltip(_description!);
  }

  if (exception != null) {
    return 'EXCEPTION (${exception.runtimeType})';
  }

  if (ifNull != null && value == null) {
    return _addTooltip(ifNull!);
  }

  String result = valueToString(parentConfiguration: parentConfiguration);
  if (result.isEmpty && ifEmpty != null) {
    result = ifEmpty!;
  }
  return _addTooltip(result);
}