I found this : ```val timer = (0..MyInterval) .a...
# coroutines
p
I found this :
Copy code
val timer = (0..MyInterval) 
 .asSequence()
 .asFlow()
 .onEach { delay(1_000) }

timer.collect { //do something }
But how do I stop the timer as I do with if(whatever) foo = false?
g
this example doesn’t really make sense for me, looks unnecessary over-complicated
👍🏽 1
n
An extra problem here is that if the collecting code has another delay() or takes a lot of time, the timing of the timer will be affected. Depending on your use case this might be an issue.
👍🏽 1