OnInitContext
When the ViewModel is ready this API allows launching coroutines.
This object gets passed to the observer registered via OnInit.observe.
Properties
Link copied to clipboard
Launcher for tasks that will terminate (e.g. initial network requests, cache refresh, ...).
Link copied to clipboard
The underlying ViewModel in case you might need its CoroutineLauncher.scope for ContextualVal resolution.
Functions
Link copied to clipboard
open fun launch(context: CoroutineContext = EmptyCoroutineContext, longRunning: Boolean = false, start: CoroutineStart = CoroutineStart.DEFAULT, withLoading: MutableStateFlow<Int>? = if (longRunning) null else oneShot.loading, onError: suspend (Throwable) -> Unit? = null, block: suspend CoroutineScope.() -> Unit): Job
Launches a coroutine. Mark long-running coroutines by setting longRunning to true
.