unregister method
Unregisters a query from all dependency relationships.
Removes the query as both a parent and a child.
Implementation
void unregister(String key) {
// Remove as child
final parent = _childToParent.remove(key);
if (parent != null) {
_parentToChildren[parent]?.remove(key);
if (_parentToChildren[parent]?.isEmpty ?? false) {
_parentToChildren.remove(parent);
}
}
// Remove as parent (orphan all children)
final children = _parentToChildren.remove(key);
if (children != null) {
children.forEach(_childToParent.remove);
}
}