Model constructor

Model(
  1. ModelInfo model
)

Implementation

Model(ModelInfo model) {
  _cModel = checkObxPtr(bindings.obx_model(), 'failed to create model');

  try {
    model.entities.forEach(addEntity);

    // set last entity id
    bindings.obx_model_last_entity_id(
        _cModel, model.lastEntityId.id, model.lastEntityId.uid);
  } catch (e) {
    bindings.obx_model_free(_cModel);
    _cModel = null;
    rethrow;
  }
}