toStringShallow method Null safety

String toStringShallow(
  1. {String joiner = ', ',
  2. DiagnosticLevel minLevel = DiagnosticLevel.debug}
)
inherited

Returns a one-line detailed description of the object.

This description is often somewhat long. This includes the same information given by toStringDeep, but does not recurse to any children.

joiner specifies the string which is place between each part obtained from debugFillProperties. Passing a string such as '\n ' will result in a multiline string that indents the properties of the object below its name (as per toString).

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

See also:

  • toString, for a brief description of the object.
  • toStringDeep, for a description of the subtree rooted at this object.

Implementation

String toStringShallow({
  String joiner = ', ',
  DiagnosticLevel minLevel = DiagnosticLevel.debug,
}) {
  String? shallowString;
  assert(() {
    final StringBuffer result = StringBuffer();
    result.write(toString());
    result.write(joiner);
    final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
    debugFillProperties(builder);
    result.write(
      builder.properties.where((DiagnosticsNode n) => !n.isFiltered(minLevel))
          .join(joiner),
    );
    shallowString = result.toString();
    return true;
  }());
  return shallowString ?? toString();
}