Closed
Description
Function signature
suspend fun <T> Flow<T>.collectLatest(action: suspend (value: T) -> Unit): Unit
Behavior
val flow = flowOf(1, 2, 3, 4, 5)
flow.collectLatest { value: Int -> // This lambda would be canceled if a new value is emitted although it hasn't been finished.
delay(100)
println(value) // So only '5' will be printed.
}