findAll method
Find multiple nodes matching this query inside another node.
Implementation
Iterable<T> findAll(Node root) {
var result = <T>[];
// get all nodes of type T
var candidates = root.children.where((e) => e.runtimeType == T).map((e) => e as T);
// get all matches from candidates
result.addAll(candidates.where(matches));
// then get all matches from root's grandchildren and beyond
for (var child in root.children) {
result.addAll(findAll(child));
}
return result;
}