fold<V> method

V fold<V>(
  1. V fn(
    1. Path path,
    2. T? value,
    3. Map<ChildKey, V> children
    )
)

Folds the tree bottom-up: fn gets each node's path, value and its children's results.

Implementation

V fold<V>(V Function(Path path, T? value, Map<ChildKey, V> children) fn) =>
    _fold(Path.empty, fn);