runningCount

fun <T> Flow<T>.runningCount(): Flow<Int>

Emits the running number of values collected so far, starting at 1 for the first value.

The count restarts for every collection. An empty upstream produces nothing.