foldRight<B> method

B foldRight<B>(
  1. B initialValue,
  2. B combine(
    1. B previousValue,
    2. T element
    )
)

Fold this 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(B previousValue, T element) combine,
) {
  var value = initialValue;
  for (var element in reversed) {
    value = combine(value, element);
  }
  return value;
}