mapWithIndex<B> method
Same as map
but provides also the index
of each mapped
element in the mapping function (toElement
).
Implementation
Iterable<B> mapWithIndex<B>(B Function(T t, int index) toElement) sync* {
var index = 0;
for (var value in this) {
yield toElement(value, index);
index += 1;
}
}