removeDependencyExact method
Removes the dependency stored under exactTypeEntity (the raw registry
key — i.e. dependency.typeEntity, NOT the inner T).
If the group becomes empty after removal, the group itself is removed.
Use this when you already hold a Dependency and just need to evict its
exact slot (e.g. SupportsUnregisterAll). For lookups keyed by an inner
type entity (e.g. Foo rather than Sync<Foo>), use removeDependencyK.
Implementation
Option<Dependency> removeDependencyExact(
Entity exactTypeEntity, {
Entity groupEntity = const DefaultEntity(),
}) {
final group = _state[groupEntity];
if (group == null) {
return const None();
}
final removed = Option.from(group.remove(exactTypeEntity));
if (removed.isNone()) {
return const None();
}
_detachFromTypeIndex(exactTypeEntity, groupEntity);
if (group.isEmpty) {
_state.remove(groupEntity);
}
_fireOnChange();
return removed;
}