Skip to content

Instantly share code, notes, and snippets.

@Zimins
Created June 16, 2021 14:38
Show Gist options
  • Save Zimins/3fef78e7ee202ecd7f61ff5203ed26c8 to your computer and use it in GitHub Desktop.
Save Zimins/3fef78e7ee202ecd7f61ff5203ed26c8 to your computer and use it in GitHub Desktop.
flow collect test
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
fun main(){
runBlocking {
println("main started")
val normalFlow = flow {
println("Flow starts emit")
emit(10)
emit(20)
emit(30)
}
println("Starts collecting")
normalFlow.collect {
println("collected $it")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment