foldRight<B> method

B foldRight<B>(
  1. B initialValue,
  2. B f(
    1. T element,
    2. B accumulator
    )
)

Fold a List into a single value by aggregating each element of the list from the last to the first.

Implementation

B foldRight<B>(B initialValue, B Function(T element, B accumulator) f) =>
    toList().reversed.fold(initialValue, (a, e) => f(e, a));