Snapshot

sealed class Snapshot

A snapshot of the values return by mutable states and other state objects. All state object will have the same value in the snapshot as they had when the snapshot was created unless they are explicitly changed in the snapshot.

To enter a snapshot call enter. The snapshot is the current snapshot as returned by currentSnapshot until the control returns from the lambda (or until a nested enter is called). All state objects will return the values associated with this snapshot, locally in the thread, until enter returns. All other threads are unaffected.

Snapshots can be nested by calling takeNestedSnapshot.

See also

Types

Companion
Link copied to clipboard
common
object Companion

Functions

dispose
Link copied to clipboard
common
open fun dispose()
Dispose the snapshot.
enter
Link copied to clipboard
common
inline fun <T> enter(block: () -> T): T
Enter the snapshot.
equals
Link copied to clipboard
common
open operator fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
common
open fun hashCode(): Int
hasPendingChanges
Link copied to clipboard
common
abstract fun hasPendingChanges(): Boolean
Whether there are any pending changes in this snapshot.
takeNestedSnapshot
Link copied to clipboard
common
abstract fun takeNestedSnapshot(readObserver: SnapshotReadObserver? = null): Snapshot
Take a snapshot of the state values in this snapshot.
toString
Link copied to clipboard
common
open fun toString(): String

Properties

id
Link copied to clipboard
common
open var id: Int
The snapshot id of the snapshot.
readonly
Link copied to clipboard
common
abstract val readonly: Boolean
True if any change to a state object in this snapshot will throw.
root
Link copied to clipboard
common
abstract val root: Snapshot
The root snapshot for this snapshot.

Inheritors

MutableSnapshot
Link copied to clipboard