onEachIndexed

fun <T> Flow<T>.onEachIndexed(action: suspend (index: Int, value: T) -> Unit): Flow<T>

Invokes action with each value and its 0-based position, then emits the value unchanged.

The index restarts at 0 for every collection.