foldLeftWithIndex<B> method
Same as foldLeft (fold) but provides also the index of each mapped
element in the combine function.
Implementation
B foldLeftWithIndex<B>(
B initialValue,
B Function(B previousValue, T element, int index) combine,
) {
var index = 0;
var value = initialValue;
for (final element in this) {
value = combine(value, element, index);
index += 1;
}
return value;
}