runningReduceIndexed method
Returns a Iterable containing successive accumulation values generated
by applying combine
function from left to right to each element, its
index in the original collection and current accumulator value that starts
with the first element of this collection.
Implementation
Iterable<E> runningReduceIndexed(
E Function(int index, E value, E element) combine,
) {
if (isEmpty) return Iterable.empty();
var value = first;
return withIndex.skip(1).map((indexedValue) {
value = combine(indexedValue.index, value, indexedValue.value);
return value;
});
}