visitAncestorElements abstract method

void visitAncestorElements(
  1. bool visitor(
    1. Element element
    )
)

Walks the ancestor chain, starting with the parent of this build context's component, invoking the argument for each ancestor. The callback is given a reference to the ancestor component's corresponding Element object. The walk stops when it reaches the root component or when the callback returns false. The callback must not return null.

This is useful for inspecting the component tree.

Calling this method is relatively expensive (O(N) in the depth of the tree).

Implementation

void visitAncestorElements(bool Function(Element element) visitor);