Harsh P.
07/28/2022, 9:16 PMLandry Norris
07/28/2022, 9:20 PMLandry Norris
07/28/2022, 9:23 PMfun tickerFlow(period: Duration, initialDelay: Duration = Duration.ZERO) = flow {
delay(initialDelay)
while (true) {
emit(Unit)
delay(period)
}
}
as suggested by one of the answers. It’s concise and should work fine.Harsh P.
07/28/2022, 9:35 PMHarsh P.
07/28/2022, 9:37 PMLandry Norris
07/28/2022, 9:37 PMimplementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3")
in the build gradle?Landry Norris
07/28/2022, 9:37 PMHarsh P.
07/28/2022, 9:40 PMHarsh P.
07/28/2022, 9:41 PMLandry Norris
07/28/2022, 9:42 PMHarsh P.
07/28/2022, 9:47 PMLandry Norris
07/28/2022, 9:49 PMfun tickerFlow(period: Long, initialDelay: Long = 0) = flow {
delay(initialDelay)
while (true) {
emit(Unit)
delay(period)
}
}
Harsh P.
07/29/2022, 4:25 AM