mapIndexed<R> method
Maps each element together with its index.
Example:
['a', 'b'].mapIndexed((i, v) => '$i:$v'); // ['0:a', '1:b']
Implementation
Iterable<R> mapIndexed<R>(R Function(int index, E element) convert) sync* {
int index = 0;
for (final E element in this) {
yield convert(index++, element);
}
}