fromMap static method

String fromMap(
  1. Map<String, Map> map, {
  2. bool startingAtTop = true,
})

Draws a tree from a nested map. Given a map like:

{
  "analyzer": {
    "args": {
      "collection": ""
    },
    "logging": {}
  },
  "barback": {}
}

this renders:

analyzer
|-- args
|   '-- collection
'---logging
barback

Items with no children should have an empty map as the value.

If startingAtTop is false, the tree will be shown as:

|-- analyzer
|   '-- args
|   |   '-- collection
'   '---logging
'---barback

Implementation

static String fromMap(Map<String, Map> map, {bool startingAtTop = true}) {
  final buffer = StringBuffer();
  _draw(buffer, '', null, map, depth: startingAtTop ? 0 : 1);
  return buffer.toString();
}