Created
September 22, 2020 14:25
-
-
Save jaozinfs/9fa5cc920fdacfb246a192cad8d6bbc9 to your computer and use it in GitHub Desktop.
Flow incrementador
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
suspend fun increase(delay: Long):Flow<Int> = flow { | |
var start = 0 | |
do { | |
emit(start) | |
delay(delay) | |
start++ | |
} while (coroutineContext.isActive) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment