notifyDependent method
Called by notifyClients for each dependent.
Calls dependent.didChangeDependencies()
by default.
Subclasses can override this method to selectively call didChangeDependencies based on the value of getDependencies.
See also:
- updateDependencies, which is called each time a dependency is created with dependOnInheritedWidgetOfExactType.
- getDependencies, which returns the current value for a dependent element.
- setDependencies, which sets the value for a dependent element.
- InheritedModel, which is an example of a class that uses this method to manage dependency values.
Implementation
@override
void notifyDependent(InheritedWidget oldWidget, Element dependent) {
// select can never be used inside `didChangeDependencies`, so if the
// dependent is already marked as needed build, there is no point
// in executing the selectors.
if (dependent.dirty) return;
final dependency = getDependencies(dependent);
if (dependency is! ReactterDependency ||
_hasInstanceOrStatesDirty(dependency)) {
dependent.didChangeDependencies();
_removeDependencies(dependent);
}
}