PreferencesGlanceStateDefinition

object PreferencesGlanceStateDefinition : GlanceStateDefinition


Base class helping the creation of a state using DataStore's Preferences.

Summary

Public functions

open suspend DataStore<Preferences>
getDataStore(context: Context, fileKey: String)

Creates the underlying data store.

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

This file indicates the location of the persisted data.

Public functions

getDataStore

open suspend fun getDataStore(context: Context, fileKey: String): DataStore<Preferences>

Creates the underlying data store.

Parameters
context: Context

The context used to create locate the file directory

fileKey: String

The 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.

getLocation

Added in 1.1.1
open fun getLocation(context: Context, fileKey: String): File

This file indicates the location of the persisted data.

Parameters
context: Context

The context used to create the file directory

fileKey: String

The 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.