Commit d8f2d018 authored by Adam Barth's avatar Adam Barth

Expose dispatchDependencyChanged in InheritedWidget (#3580)

Some inherited widgets want to call this function direction, for example to
notify children when a mutable model object changes. Exposing this function to
subclasses of InheritedWidget is clear then forcing them to compute
updateShouldNotify for mutable model objects.
parent b0dca796
......@@ -1738,6 +1738,16 @@ class InheritedElement extends _ProxyElement {
void notifyDescendants(InheritedWidget oldWidget) {
if (!widget.updateShouldNotify(oldWidget))
return;
dispatchDependenciesChanged();
}
/// Notifies all dependent elements that this inherited widget has changed.
///
/// [InheritedElement] calls this function if [InheritedWidget.updateShouldNotify]
/// returns true. Subclasses of [InheritedElement] might wish to call this
/// function at other times if their inherited information changes outside of
/// the build phase.
void dispatchDependenciesChanged() {
final Type ourRuntimeType = widget.runtimeType;
for (Element dependant in _dependents) {
dependant.dependenciesChanged(ourRuntimeType);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment