mapAt static method

Map<String, dynamic> mapAt(
  1. Map<String, dynamic> root,
  2. List<String> path
)

The map at path under root, created on the way when missing.

Implementation

static Map<String, dynamic> mapAt(Map<String, dynamic> root, List<String> path) {
  var node = root;
  for (final key in path) {
    final value = node[key];
    node = value is Map<String, dynamic> ? value : node[key] = <String, dynamic>{};
  }
  return node;
}