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

ModifierLocalConsumer

public interface ModifierLocalConsumer extends Modifier.Element


A Modifier that can be used to consume ModifierLocals that were provided by other modifiers to the left of this modifier, or above this modifier in the layout tree.

Summary

Public methods

abstract void

This function is called whenever one of the consumed values has changed.

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

onModifierLocalsUpdated

abstract void onModifierLocalsUpdated(@NonNull ModifierLocalReadScope scope)

This function is called whenever one of the consumed values has changed. This could be called in response to the modifier being added, removed or re-ordered.