withCompositionLocal

Composable Function

Common
@Composable
public inline fun <T> withCompositionLocal(
    value: ProvidedValue<*>,
    content: @Composable () -> T,
): T

withCompositionLocal binds value to ProvidableCompositionLocal key and returns the result produced by the content lambda. Use with non-unit returning content lambdas or else use CompositionLocalProvider. Reading the CompositionLocal using CompositionLocal.current will return the value provided in CompositionLocalProvider's value parameter for all composable functions called directly or indirectly in the content lambda.