addEntity method

void addEntity(
  1. ModelEntity entity
)

Implementation

void addEntity(ModelEntity entity) {
  // start entity
  final name = entity.name.toNativeUtf8();
  try {
    _check(C.model_entity(_cModel, name.cast(), entity.id.id, entity.id.uid));
  } finally {
    calloc.free(name);
  }

  if (entity.flags != 0) _check(C.model_entity_flags(_cModel, entity.flags));

  // add all properties
  entity.properties.forEach(addProperty);

  _check(C.model_entity_last_property_id(
      _cModel, entity.lastPropertyId.id, entity.lastPropertyId.uid));

  entity.relations.forEach(addRelation);
}