static String mapToString(Map m) { // Reuses the list in IterableBase for detecting toString cycles. if (_isToStringVisiting(m)) { return '{...}'; } var result = StringBuffer(); try { _toStringVisiting.add(m); result.write('{'); bool first = true; m.forEach((k, v) { if (!first) { result.write(', '); } first = false; result.write(k); result.write(': '); result.write(v); }); result.write('}'); } finally { assert(identical(_toStringVisiting.last, m)); _toStringVisiting.removeLast(); } return result.toString(); }
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-collection/MapBase/mapToString.html