flatten method

List<T> flatten(
  1. bool isLeaf(
    1. T element
    )
)

Lists all leafs of this tree Specify how to detect the leafs with isLeaf.

Implementation

List<T> flatten(bool Function(T element) isLeaf) {
  final leafs = <T>[];
  _addLeafs(root, isLeaf, leafs);

  return leafs;
}