searchLeavesWithTitleDFS<T extends AbsNodeType> function
void
searchLeavesWithTitleDFS<T extends AbsNodeType>()
Using DFS to return leaves if each of leaf's data contains searching text
Implementation
void searchLeavesWithTitleDFS<T extends AbsNodeType>(
TreeType<T> tree, String text, List<TreeType<T>> result) {
if (tree.data.isUnavailable) return;
if (tree.isLeaf && tree.data.title.contains(text)) {
result.add(tree);
return;
}
for (var child in tree.children) {
searchAllTreesWithTitleDFS(child, text, result);
}
}