collectAllSemanticsNodesFrom function
- SemanticsNode root, {
- DebugSemanticsDumpOrder order = DebugSemanticsDumpOrder.traversalOrder,
Provides an iterable that efficiently returns all the SemanticsNodes rooted at the given SemanticsNode. See CachingIterable for details.
By default, this will traverse the semantics tree in semantic traversal
order, but the traversal order can be changed by passing in a different
value to order
.
This function must be called again if the semantics change. 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.
Implementation
Iterable<SemanticsNode> collectAllSemanticsNodesFrom(
SemanticsNode root, {
DebugSemanticsDumpOrder order = DebugSemanticsDumpOrder.traversalOrder,
}) {
return CachingIterable<SemanticsNode>(_DepthFirstSemanticsTreeIterator(root, order));
}