For convenience you can use this extension method.
extension CollectionUtil on Iterable {
Iterable mapIndexed(E Function(int index, T item) transform) sync* {
var index = 0;
for (final item in this) {
yield transform(index, item as T);
index++;
}
}
}