mapIndexed<U> method
Just like map, but with access to the element's current index.
Example
[1, 2, 3].mapIndexed((number, index) => number * 2); // [2, 4, 6]
Implementation
Iterable<U> mapIndexed<U>(
U Function(T currentValue, int index) transformer) sync* {
final it = iterator;
var index = 0;
while (it.moveNext()) {
yield transformer(it.current, index++);
}
}