withCompositionLocals

Composable Function

Common
@Composable
public inline fun <T> withCompositionLocals(
    vararg values: ProvidedValue<*>,
    content: @Composable () -> T,
): T

withCompositionLocals binds values 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 values provided in CompositionLocalProvider's values parameter for all composable functions called directly or indirectly in the content lambda.