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

LiveLiteralKt

public final class LiveLiteralKt


Summary

Public methods

static final void

When called, all live literals will start to use their values backed by MutableState.

static final boolean
static final @NonNull State<@NonNull T>

Constructs a State object identified by the provided global key and initialized to the provided value.

static final void

Updates the value of a State object that was created by liveLiteral with the same key.

Public methods

enableLiveLiterals

@InternalComposeApi
public static final void enableLiveLiterals()

When called, all live literals will start to use their values backed by MutableState.

Caution: This API is intended to be used by tooling only. Use at your own risk.

isLiveLiteralsEnabled

public static final boolean isLiveLiteralsEnabled()

liveLiteral

@InternalComposeApi
@ComposeCompilerApi
public static final @NonNull State<@NonNull T> <T extends Object> liveLiteral(@NonNull String key, @NonNull T value)

Constructs a State object identified by the provided global key and initialized to the provided value. This value may then be updated from tooling with the updateLiveLiteralValue API. Only a single State object will be created for any given key.

Caution: This API is intended to be used by tooling only. Use at your own risk.

updateLiveLiteralValue

@InternalComposeApi
public static final void updateLiveLiteralValue(@NonNull String key, Object value)

Updates the value of a State object that was created by liveLiteral with the same key.