Created
June 16, 2021 14:38
-
-
Save Zimins/3fef78e7ee202ecd7f61ff5203ed26c8 to your computer and use it in GitHub Desktop.
flow collect test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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