SnapshotMutationPolicy

interface SnapshotMutationPolicy<T>

A policy to control how the result of mutableStateOf report and merge changes to the state object.

A mutation policy can be passed as an parameter to mutableStateOf, and ambientOf.

Typically, one of the stock policies should be used such as referentialEqualityPolicy, structuralEqualityPolicy, or neverEqualPolicy. However, a custom mutation policy can be created by implementing this interface, such as a counter policy,

Samples

androidx.compose.runtime.samples.counterSample

Functions

equals
Link copied to clipboard
common
open operator fun equals(other: Any?): Boolean
equivalent
Link copied to clipboard
common
abstract fun equivalent(a: T, b: T): Boolean
Determine if setting a state value's are equivalent and should be treated as equal.
hashCode
Link copied to clipboard
common
open fun hashCode(): Int
merge
Link copied to clipboard
common
open fun merge(previous: T, current: T, applied: T): T?
Merge conflicting changes in snapshots.
toString
Link copied to clipboard
common
open fun toString(): String