prettyPrintMap function

String prettyPrintMap(
  1. Map map
)

Returns a pretty-printed version of map, with namespaced keys grouped together.

Useful for debugging props/state maps (and build in to UiProps.toString/UiState.toString).

Only for use when debugging.

Example:

var map = {'foo': 'bar'};
Foo(map)
  ..bar = 1
  ..baz = 2;
Bar(map)
  ..foo = 1
  ..baz = 2;

assert(map.toString == '{foo: bar, Foo.bar: true, Foo.baz: false, Bar.foo: 1, Bar.baz: 2}');
assert(prettyPrintMap(map) == '''
{
  Foo…
    .bar: true,
    .baz: false,

  Bar…
    .foo: 1,
    .baz: 2,

  foo: bar
}
'''.trim());

Implementation

String prettyPrintMap(Map map) {
  return _prettyObj(map);
}