{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

ProvidableCompositionLocal

public abstract class ProvidableCompositionLocal<T extends Object> extends CompositionLocal

java.lang.Object
   ↳ androidx.compose.runtime.CompositionLocal
     ↳ androidx.compose.runtime.ProvidableCompositionLocal

A ProvidableCompositionLocal can be used in CompositionLocalProvider to provide values.

See also
compositionLocalOf
staticCompositionLocalOf
CompositionLocal
CompositionLocalProvider

Summary

Public methods

final @NonNull ProvidedValue<@NonNull T>
provides(@NonNull T value)

Associates a CompositionLocal key to a value in a call to CompositionLocalProvider.

final @NonNull ProvidedValue<@NonNull T>

Associates a CompositionLocal key to a value in a call to CompositionLocalProvider if the key does not already have an associated value.

Inherited methods

From androidx.compose.runtime.CompositionLocal
final @NonNull T

Return the value provided by the nearest CompositionLocalProvider component that invokes, directly or indirectly, the composable function that uses this property.

Public methods

provides

public final @NonNull ProvidedValue<@NonNull T> provides(@NonNull T value)

Associates a CompositionLocal key to a value in a call to CompositionLocalProvider.

providesDefault

public final @NonNull ProvidedValue<@NonNull T> providesDefault(@NonNull T value)

Associates a CompositionLocal key to a value in a call to CompositionLocalProvider if the key does not already have an associated value.