iterableToFullString static method
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.
Implementation
static String iterableToFullString(Iterable iterable,
[String leftDelimiter = '(', String rightDelimiter = ')']) {
if (isToStringVisiting(iterable)) {
return "$leftDelimiter...$rightDelimiter";
}
StringBuffer buffer = StringBuffer(leftDelimiter);
toStringVisiting.add(iterable);
try {
buffer.writeAll(iterable, ", ");
} finally {
assert(identical(toStringVisiting.last, iterable));
toStringVisiting.removeLast();
}
buffer.write(rightDelimiter);
return buffer.toString();
}