currentState

Functions summary

inline T

Retrieves the current customizable store for view specific state data as defined by GlanceStateDefinition in the surface implementation.

inline T?

Retrieves the current Preferences value of the provided Preferences.Key from the current state when Preferences store is used as GlanceStateDefinition in the surface implementation.

Functions

currentState

@Composable
inline fun <T : Any?> currentState(): T

Retrieves the current customizable store for view specific state data as defined by GlanceStateDefinition in the surface implementation.

Returns
T

the current store of the provided type T

currentState

@Composable
inline fun <T : Any?> currentState(key: Preferences.Key<T>): T?

Retrieves the current Preferences value of the provided Preferences.Key from the current state when Preferences store is used as GlanceStateDefinition in the surface implementation.

Parameters
key: Preferences.Key<T>

the Preferences.Key to retrieve its value

Returns
T?

the stored value or null if not available.