visitAncestorElements method

  1. @override
void visitAncestorElements(
  1. RenderElementVisitor visitor
)
override

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

Implementation

@override
void visitAncestorElements(visitor) {
  RenderElement? ancestor = _parent;

  while (null != ancestor && !ancestor.frameworkIsRoot) {
    if (!visitor(ancestor)) break;

    ancestor = ancestor._parent;
  }
}