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

ModifierLocalProvider

public interface ModifierLocalProvider<T extends Object> extends Modifier.Element


A Modifier that can be used to provide ModifierLocals that can be read by other modifiers to the right of this modifier, or modifiers that are children of the layout node that this modifier is attached to.

Summary

Public methods

abstract @NonNull ProvidableModifierLocal<@NonNull T>

Each ModifierLocalProvider stores a ModifierLocal instance that can be used as a key by a ModifierLocalConsumer to read the provided value.

abstract @NonNull T

The provided value, that can be read by modifiers on the right of this modifier, and modifiers added to children of the composable using this modifier.

Inherited methods

From androidx.compose.ui.Modifier
default @NonNull Modifier

Concatenates this modifier with another.

From androidx.compose.ui.Modifier.Element
default boolean
all(
    @NonNull Function1<@NonNull Modifier.Element, @NonNull Boolean> predicate
)

Returns true if predicate returns true for all Elements in this Modifier or if this Modifier contains no Elements.

default boolean
any(
    @NonNull Function1<@NonNull Modifier.Element, @NonNull Boolean> predicate
)

Returns true if predicate returns true for any Element in this Modifier.

default @NonNull R
<R extends Object> foldIn(
    @NonNull R initial,
    @NonNull Function2<@NonNull R, @NonNull Modifier.Element, @NonNull R> operation
)

Accumulates a value starting with initial and applying operation to the current value and each element from outside in.

default @NonNull R
<R extends Object> foldOut(
    @NonNull R initial,
    @NonNull Function2<@NonNull Modifier.Element, @NonNull R, @NonNull R> operation
)

Accumulates a value starting with initial and applying operation to the current value and each element from inside out.

Public methods

getKey

abstract @NonNull ProvidableModifierLocal<@NonNull T> getKey()

Each ModifierLocalProvider stores a ModifierLocal instance that can be used as a key by a ModifierLocalConsumer to read the provided value.

getValue

abstract @NonNullgetValue()

The provided value, that can be read by modifiers on the right of this modifier, and modifiers added to children of the composable using this modifier.