launchOnceStateAtLeast
fun LifecycleOwner.launchOnceStateAtLeast(state: Lifecycle.State, context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT, cancelWhenBelow: Boolean = true, block: suspend CoroutineScope.() -> Unit): Job
Waits until the lifecycle reaches the given state and then launches a coroutine with the given block.
Parameters
cancelWhenBelow
Pass false
to keep the coroutine running even if the state falls below state.