enterMapContainer method

void enterMapContainer(
  1. String name
)

Implementation

void enterMapContainer(String name) {
  assert(!_metadata.containsKey(name),
      'The same boundary key[$name] already exists.');
  final lastContainer = _getContainer();
  if (lastContainer != null) {
    if (lastContainer is List) {
      List container = lastContainer;
      Map map = {};
      container.add(map);
      _containers.add(map);

      List tagContainer = _getTagMapContainer();
      Map tagMap = {};
      tagContainer.add(tagMap);
      _tagMapContainers.add(tagMap);
    } else if (lastContainer is Map) {
      Map container = lastContainer;
      Map map = {};
      container[name] = map;
      _containers.add(map);

      Map tagContainer = _getTagMapContainer();
      Map tagMap = {};
      tagContainer[name] = tagMap;
      _tagMapContainers.add(tagMap);
    }
  } else {
    _metadata[name] = {};
    _containers.add(_metadata[name]);

    _tagMap[name] = {};
    _tagMapContainers.add(_tagMap[name]);
  }
}