MeshSchema constructor

MeshSchema({
  1. required String rootTagName,
  2. required List<ElementType> elements,
})

Implementation

MeshSchema({required String rootTagName, required List<ElementType> elements}) : _rootTagName = rootTagName, _elements = elements {
  for (final t in elements) {
    if (elementsByTagName.containsKey(t.tagName)) {
      throw MeshSchemaValidationException("${t.tagName} was found more than once in tags");
    }
    elementsByTagName[t.tagName] = t;
  }

  if (!elementsByTagName.containsKey(rootTagName)) {
    throw MeshSchemaValidationException("$rootTagName was not found in tags");
  }

  validate();
}