ApplicationCoroutineScope
A process-wide CoroutineScope that outlives individual ViewModels and UI components.
Use this scope for fire-and-forget cleanup work that must continue after a ViewModel's own scope has been cancelled (for example, deleting temporary files in onCleared()). Backed by a SupervisorJob so failures in one child do not cancel siblings, and by ioDispatcher so work runs off the main thread.
Prefer scoping work to a more specific scope (like viewModelScope) whenever possible; this scope is an escape hatch and should be used sparingly.
Functions
Link copied to clipboard
fun CoroutineScope.handledLaunch(context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT, block: suspend CoroutineScope.() -> Unit): Job
Launches a new coroutine with a central CoroutineExceptionHandler that reports errors to Exceptions.