bool visitAncestor(Element element)

Applied to each ancestor of the dispatch target. Dispatches this Notification to ancestor NotificationListener widgets.

Source

bool visitAncestor(Element element) {
  if (element is StatelessElement &&
      element.widget is NotificationListener<Notification>) {
    final NotificationListener<Notification> widget = element.widget;
    if (widget._dispatch(this)) // that function checks the type dynamically
      return false;
  }
  return true;
}