/Dart 2

iterableToFullString method

String iterableToFullString (Iterable iterable, [ String leftDelimiter = '(', String rightDelimiter = ')' ])

Converts an Iterable to a string.

Converts each elements to a string, and separates the results by ", ". Then wraps the result in leftDelimiter and rightDelimiter.

Unlike iterableToShortString, this conversion doesn't omit any elements or puts any limit on the size of the result.

Handles circular references where converting one of the elements to a string ends up converting iterable to a string again.


static String iterableToFullString(Iterable iterable,
    [String leftDelimiter = '(', String rightDelimiter = ')']) {
  if (_isToStringVisiting(iterable)) {
    return "$leftDelimiter...$rightDelimiter";
  StringBuffer buffer = StringBuffer(leftDelimiter);
  try {
    buffer.writeAll(iterable, ", ");
  } finally {
    assert(identical(_toStringVisiting.last, iterable));
  return buffer.toString();

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.