pairwise

fun <T> ERROR CLASS: Symbol not found for Flow<T>.pairwise(): ERROR CLASS: Symbol not found for Flow<ERROR CLASS: Symbol not found for Pair<T, T>>(source)

For each emission after the first, emits a Pair(previous, current).

Example:

flowOf(1, 2, 5, 10)
.pairwise()
.collect { (prev, current)->
println("Received pair $prev to $current")
}

Result: (1,2) (2,5) (5, 10)