ElementType constructor

ElementType({
  1. required String tagName,
  2. required String? description,
  3. required List<ElementProperty> properties,
})

Implementation

ElementType({required String tagName, required String? description, required List<ElementProperty> properties})
  : _tagName = tagName,
    _description = description,
    _properties = List<ElementProperty>.from(properties) {
  for (final p in _properties) {
    if (p is ChildProperty) {
      if (_childPropertyName != null) {
        throw MeshSchemaValidationException("Only one child property is allowed");
      }
      _childPropertyName = p.name;
    }

    if (_propertyLookup.containsKey(p.name)) {
      throw MeshSchemaValidationException("Duplicate property ${p.name}");
    }
    _propertyLookup[p.name] = p;
  }
}