Open class that should be extended to define specific key-value types to be stored in the StateStore to ensure it is type safe.

The class T should be the value of the type that that should be retrieved and should also be @Serializable along with the extending class.

Summary

Public constructors

<T : Any?> StateStoreKey(
    defaultValue: T,
    autoClearKey: StateStoreKey<*>?,
    shouldClearState: (StateStore) -> Boolean
)
Cmn

Public properties

StateStoreKey<*>?

set this if you would like the state associated with this key to be automatically cleared from the StateStore when shouldClearState is true.

Cmn
T

an instance of the type T that is associated with this key by default.

Cmn
(StateStore) -> Boolean

the condition to determine whether the state should be cleared or not.

Cmn

Public constructors

StateStoreKey

<T : Any?> StateStoreKey(
    defaultValue: T,
    autoClearKey: StateStoreKey<*>? = null,
    shouldClearState: (StateStore) -> Boolean = { true }
)
Parameters
defaultValue: T

an instance of the type T that is associated with this key by default.

autoClearKey: StateStoreKey<*>? = null

set this if you would like the state associated with this key to be automatically cleared from the StateStore when shouldClearState is true.

shouldClearState: (StateStore) -> Boolean = { true }

the condition to determine whether the state should be cleared or not.

Public properties

autoClearKey

@Transient
val autoClearKey: StateStoreKey<*>?

set this if you would like the state associated with this key to be automatically cleared from the StateStore when shouldClearState is true.

defaultValue

val defaultValue: T

an instance of the type T that is associated with this key by default.

shouldClearState

@Transient
val shouldClearState: (StateStore) -> Boolean

the condition to determine whether the state should be cleared or not.