visitAncestor method
- @protected
- @mustCallSuper
@mustCallSuper, @protected
Applied to each ancestor of the dispatch target.
The Notification class implementation of this method dispatches the given Notification to each ancestor NotificationListener widget.
Subclasses can override this to apply additional filtering or to update
the notification as it is bubbled (for example, increasing a depth
field
for each ancestor of a particular type).
Implementation
@protected
@mustCallSuper
bool visitAncestor(Element element) {
if (element is StatelessElement) {
final StatelessWidget widget = element.widget;
if (widget is NotificationListener<Notification>) {
if (widget._dispatch(this, element)) // that function checks the type dynamically
return false;
}
}
return true;
}