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 dependOnInheritedComponentOfExactType.
- getDependencies, which returns the current value for a dependent element.
- setDependencies, which sets the value for a dependent element.
Implementation
@override
void notifyDependent(InheritedModel<T> oldComponent, Element dependent) {
final Set<T>? dependencies = getDependencies(dependent) as Set<T>?;
if (dependencies == null) {
return;
}
if (dependencies.isEmpty ||
(component as InheritedModel<T>).updateShouldNotifyDependent(oldComponent, dependencies)) {
dependent.didChangeDependencies();
}
}