# androidx.compose.runtime.tooling

Common/AllAndroid/JVM

## Interfaces

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionData` | A `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionData` is the data tracked by the composer during composition. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionErrorContext` | Provides a way to attach a compose stack trace to a throwable based on a location of compose node in composition. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionGroup` | `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionGroup` is a group of data slots tracked independently by composition. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionInstance` | `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionInstance` provides information about the composition of which a `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionData` is part. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionObserver` | Observe `https://developer.android.com/reference/kotlin/androidx/compose/runtime/RecomposeScope` management inside composition. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionObserverHandle` | The handle returned by `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/package-summary#(androidx.compose.runtime.Composition).setObserver(androidx.compose.runtime.tooling.CompositionObserver)` and `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/package-summary#(androidx.compose.runtime.Recomposer).observe(androidx.compose.runtime.tooling.CompositionRegistrationObserver)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionRegistrationObserver` | Observe when new compositions are added to a recomposer. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/IdentifiableRecomposeScope` | Interface providing a value to identify a scope for tooling. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/ObservableComposition` | A composition instance that supports observing lifecycle of its `https://developer.android.com/reference/kotlin/androidx/compose/runtime/RecomposeScope`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/RecompositionTracer.TraceCollector` | Records recomposition flow events. | android |

## Classes

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/ComposeStackTraceMode` | Defines how Compose runtime collects stack traces after a crash. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/LocationSourceInformation` | Source information about composable function call locations inside parent group. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/ParameterSourceInformation` | Source information about parameters of a function group. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/RecompositionTracer` | Collects recomposition flow events. | android |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/SourceInformation` | Source information of a `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionGroup`. | Cmn |

## Objects

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/ComposeToolingFlags` | This is a collection of flags which are used to enable certain tooling features across Compose libraries. | Cmn |

## Annotations

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/ComposeToolingApi` |   | Cmn |

## Top-level functions summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/SourceInformation?` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/ComposeToolingApi https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/package-summary#parseSourceInformation(kotlin.String)(data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Parses source information from a string produced by Compose compiler. | Cmn |

## Extension functions summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionInstance?` | `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionData.https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/package-summary#(androidx.compose.runtime.tooling.CompositionData).findCompositionInstance()()` Find the `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionInstance` associated with the root `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionData`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionObserverHandle` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/ExperimentalComposeRuntimeApi https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer.https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/package-summary#(androidx.compose.runtime.Recomposer).observe(androidx.compose.runtime.tooling.CompositionRegistrationObserver)(observer: https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionRegistrationObserver)` Register an observer to be notified when a composition is added to or removed from the given `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionObserverHandle?` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/ExperimentalComposeRuntimeApi https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composition.https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/package-summary#(androidx.compose.runtime.Composition).setObserver(androidx.compose.runtime.tooling.CompositionObserver)(observer: https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionObserver)` Observe the composition. | Cmn |

## Top-level properties summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocal<https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionErrorContext?>` | `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/package-summary#LocalCompositionErrorContext()` Used to attach a compose stack trace to a throwable based on a location of compose node in composition. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/ProvidableCompositionLocal<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html<https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionData>?>` | `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/package-summary#LocalInspectionTables()` A set of slot tables that where produced when in inspection mode. | Cmn |

## Top-level functions

### parseSourceInformation

Cmn Artifact: [androidx.compose.runtime:runtime](https://developer.android.com/jetpack/androidx/releases/compose-runtime) [View Source](https://cs.android.com/search?q=file:androidx/compose/runtime/tooling/SourceInformation.kt+function:parseSourceInformation) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-runtime#1.9.0)

```
@ComposeToolingApi
fun parseSourceInformation(data: String): SourceInformation?
```

Parses source information from a string produced by Compose compiler. The source information string is usually obtained from `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionGroup#sourceInfo()`.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/SourceInformation?` | parsed source information or `null` if the string is not a valid source information |

## Extension functions

### CompositionData.findCompositionInstance

Cmn Artifact: [androidx.compose.runtime:runtime](https://developer.android.com/jetpack/androidx/releases/compose-runtime) [View Source](https://cs.android.com/search?q=file:androidx/compose/runtime/tooling/CompositionData.kt+function:findCompositionInstance) Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-runtime#1.8.0)

```
fun CompositionData.findCompositionInstance(): CompositionInstance?
```

Find the `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionInstance` associated with the root `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionData`. This is only valid for instances of `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionData` that are recorded in a `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/package-summary#LocalInspectionTables()` table directly.

Even though `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionGroup`s implement the `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionData` interface, only the root `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionData` has an associated `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionInstance`. All `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionGroup` instances will return `null`.

### Recomposer.observe

Cmn Artifact: [androidx.compose.runtime:runtime](https://developer.android.com/jetpack/androidx/releases/compose-runtime) [View Source](https://cs.android.com/search?q=file:androidx/compose/runtime/tooling/CompositionObserver.kt+function:observe) Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-runtime#1.8.0)

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

Register an observer to be notified when a composition is added to or removed from the given `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer`. When this method is called, the observer will be notified of all currently registered compositions per the documentation in `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionRegistrationObserver#onCompositionRegistered(androidx.compose.runtime.tooling.ObservableComposition)`.

| Parameters |
|---|---|
| `observer: https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionRegistrationObserver` | the observer that will be informed of new compositions registered with this `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionObserverHandle` | a handle that allows the observer to be disposed and detached from the `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer`. |

### Composition.setObserver

Cmn Artifact: [androidx.compose.runtime:runtime](https://developer.android.com/jetpack/androidx/releases/compose-runtime) [View Source](https://cs.android.com/search?q=file:androidx/compose/runtime/tooling/CompositionObserver.kt+function:setObserver) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-runtime#1.9.0)

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

Observe the composition. Calling this twice on the same composition will implicitly dispose the previous observer. the `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionObserver` will be called for this composition and all sub-composition, transitively, for which this composition is a context. If `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/package-summary#(androidx.compose.runtime.Composition).setObserver(androidx.compose.runtime.tooling.CompositionObserver)` is called on a sub-composition, it will override the parent composition observer for itself and all its sub-compositions.

The observer is resolved once per composition pass, between `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionObserver#onBeginComposition(androidx.compose.runtime.tooling.ObservableComposition)` and `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/CompositionObserver#onEndComposition(androidx.compose.runtime.tooling.ObservableComposition)`. Setting or replacing the observer while a pass is in progress takes effect starting with the next pass.

| Parameters |
|---|---|
| `observer: https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/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 |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/tooling/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. |

## Top-level properties

### LocalCompositionErrorContext

Cmn Artifact: [androidx.compose.runtime:runtime](https://developer.android.com/jetpack/androidx/releases/compose-runtime) [View Source](https://cs.android.com/search?q=file:androidx/compose/runtime/tooling/CompositionErrorContext.kt+symbol:LocalCompositionErrorContext) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-runtime#1.9.0)

```
val LocalCompositionErrorContext: CompositionLocal<CompositionErrorContext?>
```

Used to attach a compose stack trace to a throwable based on a location of compose node in composition. This context is expected to be used by custom node implementations to attach diagnostic compose stack traces to exceptions in passes that are not handled by the Compose runtime (example: measure / layout / draw in Compose UI).

Compose runtime automatically appends information about exceptions that happen in composition and effects.

### LocalInspectionTables

Cmn Artifact: [androidx.compose.runtime:runtime](https://developer.android.com/jetpack/androidx/releases/compose-runtime) [View Source](https://cs.android.com/search?q=file:androidx/compose/runtime/tooling/InspectionTables.kt+symbol:LocalInspectionTables) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-runtime#1.0.0)

```
val LocalInspectionTables: ProvidableCompositionLocal<MutableSet<CompositionData>?>
```

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