Convert an Iterable
to a string like IterableBase.toString.
Allows using other delimiters than '(' and ')'.
Handles circular references where converting one of the elements
to a string ends up converting iterable
to a string again.
Source
static String iterableToShortString(Iterable iterable, [String leftDelimiter = '(', String rightDelimiter = ')']) { if (_isToStringVisiting(iterable)) { if (leftDelimiter == "(" && rightDelimiter == ")") { // Avoid creating a new string in the "common" case. return "(...)"; } return "$leftDelimiter...$rightDelimiter"; } List parts = []; _toStringVisiting.add(iterable); try { _iterablePartsToStrings(iterable, parts); } finally { assert(identical(_toStringVisiting.last, iterable)); _toStringVisiting.removeLast(); } return (new StringBuffer(leftDelimiter) ..writeAll(parts, ", ") ..write(rightDelimiter)) .toString(); }