androidx.compose.runtime.snapshots.tooling

Interfaces

SnapshotObserver

An observer for the snapshot system that notifies an observer when a snapshot is created, applied, and/or disposed.

Cmn

Classes

SnapshotInstanceObservers

The return result of SnapshotObserver.onCreating allowing the reads and writes performed in the newly created snapshot to be observed

Cmn

Extension functions summary

ObserverHandle

This is a tooling API and is not intended to be used in a production application as it will introduce global overhead to creating, applying and disposing all snapshots and, potentially, to reading and writing all state objects.

Cmn

Extension functions

observeSnapshots

@ExperimentalComposeRuntimeApi
fun Snapshot.Companion.observeSnapshots(
    snapshotObserver: SnapshotObserver
): ObserverHandle

This is a tooling API and is not intended to be used in a production application as it will introduce global overhead to creating, applying and disposing all snapshots and, potentially, to reading and writing all state objects.

Observe when snapshots are created, applied, and/or disposed. The observer can also install read and write observers on the snapshot being created.

This method is thread-safe and calling ObserverHandle.dispose on the ObserverHandle returned is also thread-safe.

Parameters
snapshotObserver: SnapshotObserver

the snapshot observer to install.

Returns
ObserverHandle

ObserverHandle an instance to unregister the snapshotObserver.