<Android. Kotlin Flow: How to cancel countdown tim...
# stackoverflow
u
Android. Kotlin Flow: How to cancel countdown timer? I have a kotlin flow timer. Here is my code: class CountDownTimer { suspend fun startTimer(value: Int, onTick: OnTickCallback, onFinish: OnFinishCallback) { onTick.invoke(0) (1..timerValue) .asSequence() .asFlow() .onEach { delay(DELAY) onTick.invoke(it) } .onCompletion { onFinish.invoke() } .cancellable() .collect() } } Everything...