collectAllElementsFrom function Null safety

Iterable<Element> collectAllElementsFrom(
  1. Element rootElement,
  2. {required bool skipOffstage}

Provides an iterable that efficiently returns all the elements rooted at the given element. See CachingIterable for details.

This method must be called again if the tree changes. You cannot call this function once, then reuse the iterable after having changed the state of the tree, because the iterable returned by this function caches the results and only walks the tree once.

The same applies to any iterable obtained indirectly through this one, for example the results of calling where on this iterable are also cached.


Iterable<Element> collectAllElementsFrom(
  Element rootElement, {
  required bool skipOffstage,
}) {
  return CachingIterable<Element>(_DepthFirstChildIterator(rootElement, skipOffstage));