removeEntity method

void removeEntity(
  1. ModelEntity entity
)

Implementation

void removeEntity(ModelEntity entity) {
  final foundEntity = findSameEntity(entity);
  if (foundEntity == null) {
    throw StateError(
        "cannot remove entity '${entity.name}' with id ${entity.id}: not found");
  }
  entities = entities.where((p) => p != foundEntity).toList();
  retiredEntityUids.add(entity.id.uid);
  for (var prop in entity.properties) {
    retiredPropertyUids.add(prop.id.uid);
  }
}