Lists all leafs of this tree Specify how to detect the leafs with isLeaf.
isLeaf
List<T> flatten(bool Function(T element) isLeaf) { var leafs = <T>[]; _addLeafs(root!, isLeaf, leafs); return leafs; }