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