notifyClients method
- @override
override
Notifies all dependent elements that this inherited widget has changed, by calling Element.didChangeDependencies.
This method must only be called during the build phase. Usually this method is called automatically when an inherited widget is rebuilt, e.g. as a result of calling State.setState above the inherited widget.
See also:
- InheritedNotifier, a subclass of InheritedWidget that also calls this method when its Listenable sends a notification.
Implementation
@override
void notifyClients(InheritedWidget oldWidget) {
assert(_debugCheckOwnerBuildTargetExists('notifyClients'));
for (Element dependent in _dependents.keys) {
assert(() {
// check that it really is our descendant
Element ancestor = dependent._parent;
while (ancestor != this && ancestor != null)
ancestor = ancestor._parent;
return ancestor == this;
}());
// check that it really depends on us
assert(dependent._dependencies.contains(this));
notifyDependent(oldWidget, dependent);
}
}