foldRightIndexed<R> method
Accumulates value starting with initialValue
and applying combine
function from right to left to each element with its index in the original
List and current accumulator value.
Implementation
R foldRightIndexed<R>(
R initialValue,
R Function(int index, R previousValue, E element) combine,
) {
var index = length - 1;
return reversed.fold(
initialValue,
(previousValue, element) => combine(index--, previousValue, element),
);
}