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) {
  var leafs = <T>[];
  _addLeafs(root!, isLeaf, leafs);
  return leafs;
}