destroyed method

void destroyed(
  1. Entity entity
)

When an entity has been destroyed, we remove it from the list and that will automatically sync that to the observable list.

Implementation

void destroyed(Entity entity) {
  final current = _entities.value;
  // Drop the guid and remove the entity from the list.
  final newList = Map.fromIterables([...current.keys], [...current.values].where((e) => e != entity));
  // Set the new list.
  _entities.add(newList);
}