mapIndexed

fun <T, R> Flow<T>.mapIndexed(transform: suspend (index: Int, value: T) -> R): Flow<R>

Maps each value through transform together with its 0-based position in the flow.

The index restarts at 0 for every collection.