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

ComposerKt

public final class ComposerKt


Summary

Public methods

static final @NonNull T
@ComposeCompilerApi
<T extends Object> cache(
    @NonNull Composer receiver,
    boolean invalid,
    @DisallowComposableCalls @NonNull Function0<@NonNull T> block
)

A Compose compiler plugin API.

static final boolean

Internal tracing API.

static final void
@ComposeCompilerApi
sourceInformation(
    @NonNull Composer composer,
    @NonNull String sourceInformation
)

A Compose internal function.

static final void

A Compose internal function.

static final void
@ComposeCompilerApi
sourceInformationMarkerStart(
    @NonNull Composer composer,
    int key,
    @NonNull String sourceInformation
)

A Compose internal function.

static final void

Internal tracing API.

static final void
@ComposeCompilerApi
traceEventStart(int key, int dirty1, int dirty2, @NonNull String info)

Internal tracing API.

Public methods

cache

@ComposeCompilerApi
public static final @NonNull T <T extends Object> cache(
    @NonNull Composer receiver,
    boolean invalid,
    @DisallowComposableCalls @NonNull Function0<@NonNull T> block
)

A Compose compiler plugin API. DO NOT call directly.

Cache, that is remember, a value in the composition data of a composition. This is used to implement remember and used by the compiler plugin to generate more efficient calls to remember when it determines these optimizations are safe.

isTraceInProgress

@ComposeCompilerApi
public static final boolean isTraceInProgress()

Internal tracing API.

Should be called without thread synchronization with occasional information loss.

sourceInformation

@ComposeCompilerApi
public static final void sourceInformation(
    @NonNull Composer composer,
    @NonNull String sourceInformation
)

A Compose internal function. DO NOT call directly.

Records source information that can be used for tooling to determine the source location of the corresponding composable function. By default, this function is declared as having no side-effects. It is safe for code shrinking tools (such as R8 or ProGuard) to remove it.

sourceInformationMarkerEnd

@ComposeCompilerApi
public static final void sourceInformationMarkerEnd(@NonNull Composer composer)

A Compose internal function. DO NOT call directly.

Records the end of a source information marker that can be used for tooling to determine the source location of the corresponding composable function that otherwise don't require tracking information such as ReadOnlyComposable functions. By default, this function is declared as having no side-effects. It is safe for code shrinking tools (such as R8 or ProGuard) to remove it.

Important that both sourceInformationMarkerStart and sourceInformationMarkerEnd are removed together or both kept. Removing only one will cause incorrect runtime behavior.

sourceInformationMarkerStart

@ComposeCompilerApi
public static final void sourceInformationMarkerStart(
    @NonNull Composer composer,
    int key,
    @NonNull String sourceInformation
)

A Compose internal function. DO NOT call directly.

Records the start of a source information marker that can be used for tooling to determine the source location of the corresponding composable function that otherwise don't require tracking information such as ReadOnlyComposable functions. By default, this function is declared as having no side-effects. It is safe for code shrinking tools (such as R8 or ProGuard) to remove it.

Important that both sourceInformationMarkerStart and sourceInformationMarkerEnd are removed together or both kept. Removing only one will cause incorrect runtime behavior.

traceEventEnd

@ComposeCompilerApi
public static final void traceEventEnd()

Internal tracing API.

Should be called without thread synchronization with occasional information loss.

traceEventStart

@ComposeCompilerApi
public static final void traceEventStart(int key, int dirty1, int dirty2, @NonNull String info)

Internal tracing API.

Should be called without thread synchronization with occasional information loss.

Parameters
int dirty1

$dirty metadata: forced-recomposition and function parameters 1..10 if present

int dirty2

$dirty2 metadata: forced-recomposition and function parameters 11..20 if present