GlanceStateDefinition

Interface

Android
interface GlanceStateDefinition<T>

Configuration definition for GlanceState. This defines where the data is stored and how the underlying data store is created. Use a unique GlanceStateDefinition to get a GlanceState, once defined, the data should be updated using the state directly, this definition should not change.

Functions

fun getLocation(context: Context, fileKey: String): File

This file indicates the location of the persisted data.

Parameters

contextThe context used to create the file directory
fileKeyThe unique string key used to name and identify the data file corresponding to a remote UI. Each remote UI has a unique UI key, used to key the data for that UI.
suspend fun getDataStore(context: Context, fileKey: String): DataStore<T>

Creates the underlying data store.

Parameters

contextThe context used to create locate the file directory
fileKeyThe unique string key used to name and identify the data file corresponding to a remote UI. Each remote UI has a unique UI key, used to key the data for that UI.