visitAncestor method

  1. @override
bool visitAncestor (Element element)
override

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

@override
bool visitAncestor(Element element) {
  if (element is RenderObjectElement && element.renderObject is RenderAbstractViewport)
    _depth += 1;
  return super.visitAncestor(element);
}