tree_iterator library

Functions

findInTree<N>(N root, GetChildren<N> getChildren, ChildMatches<N> childMatches) → N?
Searches the tree for a child that satisfies childMatches root the root of the tree getChildren must return the set of children for the current node. childMatches is called on each node in the tree. As soon as childMatches returns true then the search is terminated and the current node is returned.
traverseTree<N>(N root, GetChildren<N> getChildren, ProcessChild<N> processChild) bool
Traverses the tree calling processChild for every node in the tree.

Typedefs

ChildMatches<N> = bool Function(N child)
GetChildren<N> = List<N> Function(N node)
ProcessChild<N> = bool Function(N child)