launch

open fun launch(context: CoroutineContext = EmptyCoroutineContext, longRunning: Boolean = false, start: CoroutineStart = CoroutineStart.DEFAULT, withLoading: MutableStateFlow<Int>? = null, onError: suspend (Throwable) -> Unit? = null, block: suspend CoroutineScope.() -> Unit): Job

Launches a coroutine. Mark long-running coroutines by setting longRunning to true.

Parameters

context

additional to CoroutineScope.coroutineContext context of the coroutine.

start

coroutine start option. The default value is CoroutineStart.DEFAULT.

withLoading

Tracks loading state for the (re-)computation. Defaults to null since the OnInit already has the loading state.

onError

Optional custom error handler.

block

the coroutine code which will be invoked in the context of the provided scope.