Composable Function

currentState

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

currentState

Source set: Android
@Composable public inline fun <reified T> currentState(): T

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

Return

the current store of the provided type T

currentState

Source set: Android
@Composable
public inline fun <reified T> 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 the Preferences.Key to retrieve its value

Return

the stored value or null if not available.

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: