mapIndexedAndLast<R> method
Maps each element and its index to a new value.
This is similar to mapIndexed
but also tells you which item is the last.
Implementation
Iterable<R> mapIndexedAndLast<R>(R Function(int index, T item, bool isLast) convert) sync* {
var index = 0;
int _length = length; // In case length is not efficient.
for (var item in this) {
yield convert(index++, item, index == _length);
}
}