enterListContainer method

void enterListContainer(
  1. String name
)

Implementation

void enterListContainer(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;
      List list = [];
      container.add(list);
      _containers.add(list);

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

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

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