removeDependencyK method
Removes the dependency with the exact typeEntity
under the specified groupEntity
.
If the group becomes empty after removal, the group itself is removed.
Implementation
@protected
Option<Dependency> removeDependencyK(
Entity typeEntity, {
Entity groupEntity = const DefaultEntity(),
}) {
final group = _state[groupEntity];
if (group == null) {
return const None();
}
Option<Dependency<Object>> removed;
removed = Option.from(group.remove(TypeEntity(Sync, [typeEntity])));
if (removed.isNone()) {
removed = Option.from(group.remove(TypeEntity(Async, [typeEntity])));
}
if (removed.isNone()) {
return const None();
}
if (group.isEmpty) {
removeGroup(groupEntity: groupEntity);
}
UNSAFE:
onChange.ifSome((self, some) => some.unwrap()()).end();
return removed.map((e) => e.transf());
}