Property

LocalTaskDispatchers

The CompositionLocal to provide TaskDispatchers for running coroutines and asynchronous tasks inside a Compose UI hierarchy.

TaskDispatchersSample

@Sampled
@Composable
fun TaskDispatchersSample() {
    val taskDispatchers = LocalTaskDispatchers.current
    LaunchedEffect(taskDispatchers) {
        withContext(taskDispatchers.IO) {
            // Perform background I/O operations using the provided IO context
        }
    }
    Text("TaskDispatchers Sample")
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: