How to implement timer with Kotlin coroutines
Edit: note that the API suggested in the original answer is now marked @ObsoleteCoroutineApi: Ticker channels are not currently integrated with structured concurrency and their api will change in the future. You can now use the Flow API to create your own ticker flow: import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds import kotlinx.coroutines.* import kotlinx.coroutines.flow.* fun tickerFlow(period: Duration, … Read more