toString method

  1. @override
String toString ({TextTreeConfiguration parentConfiguration, DiagnosticLevel minLevel: DiagnosticLevel.info })

Returns a string representation of this diagnostic that is compatible with the style of the parent if the node is not the root.

parentConfiguration specifies how the parent is rendered as text art. For example, if the parent places all properties on one line, the toString for each property should avoid line breaks if possible.

minLevel specifies the minimum DiagnosticLevel for properties included in the output.

Implementation

@override
String toString({
  TextTreeConfiguration parentConfiguration,
  DiagnosticLevel minLevel: DiagnosticLevel.info,
}) {
  assert(style != null);
  assert(minLevel != null);
  if (style == DiagnosticsTreeStyle.singleLine)
    return toStringDeep(parentConfiguration: parentConfiguration, minLevel: minLevel);

  final String description = toDescription(parentConfiguration: parentConfiguration);

  if (name == null || name.isEmpty || !showName)
    return description;

  return description.contains('\n') ? '$name$_separator\n$description'
                                    : '$name$_separator $description';
}