createProperty method

ModelProperty createProperty(
  1. String name, [
  2. int uid = 0
])

Implementation

ModelProperty createProperty(String name, [int uid = 0]) {
  final id = lastPropertyId.id + 1;
  if (uid != 0 && model.containsUid(uid)) {
    throw StateError('uid already exists: $uid');
  }
  final uniqueUid = uid == 0 ? model.generateUid() : uid;

  final property =
      ModelProperty.create(IdUid(id, uniqueUid), name, 0, entity: this);
  properties.add(property);
  lastPropertyId = property.id;

  return property;
}