toString method

  1. @override
String toString([
  1. bool? prettyPrint
])
override

Returns a string representation of (some of) the elements of this.

Use either the prettyPrint or the ImmutableCollection.prettyPrint parameters to get a prettier print.

See also: ImmutableCollection

Implementation

@override
String toString([bool? prettyPrint]) {
  if (prettyPrint ?? ImmutableCollection.prettyPrint) {
    int length = _l.length;
    if (length == 0) {
      return "[]";
    } else if (length == 1) {
      return "[${_l.single}]";
    } else {
      return "[\n   ${_l.join(",\n   ")}\n]";
    }
  } else {
    return "[${_l.join(", ")}]";
  }
}