androidx.compose.runtime.tooling

Interfaces

CompositionData

A CompositionData is the data tracked by the composer during composition.

Cmn
CompositionGroup

CompositionGroup is a group of data slots tracked independently by composition.

Cmn
CompositionInstance

CompositionInstance provides information about the composition of which a CompositionData is part.

Cmn
CompositionObserver

Observe when the composition begins and ends.

Cmn
CompositionObserverHandle

The handle returned by Composition.observe and RecomposeScope.observe.

Cmn
CompositionRegistrationObserver

Observe when new compositions are added to a recomposer.

Cmn
RecomposeScopeObserver

Observer when a recompose scope is being recomposed or when the scope is disposed.

Cmn

Extension functions summary

CompositionInstance?

Find the CompositionInstance associated with the root CompositionData.

Cmn
CompositionObserverHandle?

Observe the composition.

Cmn
CompositionObserverHandle

Register an observer to be notified when a composition is added to or removed from the given Recomposer.

Cmn
CompositionObserverHandle

Observer when this scope recomposes.

Cmn

Top-level properties summary

ProvidableCompositionLocal<MutableSet<CompositionData>?>

A set of slot tables that where produced when in inspection mode.

Cmn

Extension functions

findCompositionInstance

fun CompositionData.findCompositionInstance(): CompositionInstance?

Find the CompositionInstance associated with the root CompositionData. This is only valid for instances of CompositionData that are recorded in a LocalInspectionTables table directly.

Even though CompositionGroups implement the CompositionData interface, only the root CompositionData has an associated CompositionInstance. All CompositionGroup instances will return null.

observe

@ExperimentalComposeRuntimeApi
fun Composition.observe(observer: CompositionObserver): CompositionObserverHandle?

Observe the composition. Calling this twice on the same composition will implicitly dispose the previous observer. the CompositionObserver will be called for this composition and all sub-composition, transitively, for which this composition is a context. If, however, observe is called on a sub-composition, it will override the parent composition and notification for it and all sub-composition of it, will go to its observer instead of the one registered for the parent.

Parameters
observer: CompositionObserver

the observer that will be informed of composition events for this composition and all sub-compositions for which this composition is the composition context. Observing a composition will prevent the parent composition's observer from receiving composition events about this composition.

Returns
CompositionObserverHandle?

a handle that allows the observer to be disposed and detached from the composition. Disposing an observer for a composition with a parent observer will begin sending the events to the parent composition's observer. A null indicates the composition does not support being observed.

@ExperimentalComposeRuntimeApi
fun Recomposer.observe(observer: CompositionRegistrationObserver): CompositionObserverHandle

Register an observer to be notified when a composition is added to or removed from the given Recomposer. When this method is called, the observer will be notified of all currently registered compositions per the documentation in CompositionRegistrationObserver.onCompositionRegistered.

Parameters
observer: CompositionRegistrationObserver

the observer that will be informed of new compositions registered with this Recomposer.

Returns
CompositionObserverHandle

a handle that allows the observer to be disposed and detached from the Recomposer.

observe

@ExperimentalComposeRuntimeApi
fun RecomposeScope.observe(observer: RecomposeScopeObserver): CompositionObserverHandle

Observer when this scope recomposes.

Parameters
observer: RecomposeScopeObserver

the observer that will be informed of recompose events for this scope.

Returns
CompositionObserverHandle

a handle that allows the observer to be disposed and detached from the recompose scope.

Top-level properties

LocalInspectionTables

val LocalInspectionTablesProvidableCompositionLocal<MutableSet<CompositionData>?>

A set of slot tables that where produced when in inspection mode.