QueryDependencyManager class

Manages parent-child relationships between queries.

Enables cascading cancellation when a parent query is disposed, automatically cancelling in-flight fetch operations of dependent queries.

Example:

final manager = QueryDependencyManager();
manager.registerDependency('user:123:posts', 'user:123');
manager.registerDependency('user:123:followers', 'user:123');

// When 'user:123' is disposed:
manager.notifyParentDisposed('user:123', (childKey) {
  print('Cancelling: $childKey');
});
// Output: Cancelling: user:123:posts
//         Cancelling: user:123:followers

Constructors

QueryDependencyManager()

Properties

hashCode int
The hash code for this object.
no setterinherited
relationshipCount int
Returns the total number of registered relationships.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
Clears all registered relationships.
getAllDescendants(String parentKey) Set<String>
Returns all descendant keys (children, grandchildren, etc.) for a parent.
getChildren(String parentKey) Set<String>
Returns all direct child keys for a given parent.
getParent(String childKey) String?
Returns the parent key for a given child, or null if no parent.
hasChildren(String parentKey) bool
Checks whether a query has any registered dependents.
hasParent(String childKey) bool
Checks whether a query has a parent dependency.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyAllDescendantsDisposed(String parentKey, void onDescendant(String)) → void
Notifies all descendant queries (deep) when a parent is disposed.
notifyParentDisposed(String parentKey, void onChild(String)) → void
Notifies all direct child queries when a parent is disposed.
registerDependency(String childKey, String parentKey) → void
Registers a dependency relationship between a child and parent query.
toString() String
A string representation of this object.
inherited
unregister(String key) → void
Unregisters a query from all dependency relationships.

Operators

operator ==(Object other) bool
The equality operator.
inherited