Object

SnapshotInstanceObservers

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

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Common
@ExperimentalComposeRuntimeApi
public class SnapshotInstanceObservers(
    /**
     * Called whenever a state is read in the snapshot. This is called before the read observer
     * passed to [Snapshot.takeSnapshot] or [Snapshot.takeMutableSnapshot].
     *
     * This method is called in the same thread that reads snapshot state.
     */
    public val readObserver: ((Any) -> Unit)? = null,

    /**
     * Called just before a state object is written to the first time in the snapshot or a nested
     * mutable snapshot. This might be called several times for the same object if nested mutable
     * snapshots are created as the unmodified value may be needed by the nested snapshot so a new
     * copy is created. This is not called for each write, only when the write results in the object
     * be recorded as being modified requiring a copy to be made before the write completes. This is
     * called before the write has been applied to the instance.
     *
     * This is called before the write observer passed to [Snapshot.takeMutableSnapshot].
     *
     * This method is called in the same thread that writes to the snapshot state.
     */
    public val writeObserver: ((Any) -> Unit)? = null,
)

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