observeSnapshots

Function

Common
@ExperimentalComposeRuntimeApi
public 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

snapshotObserverthe snapshot observer to install.

Returns

ObserverHandle an instance to unregister the snapshotObserver.