DataStorePreferencesStorage

inline fun <T : @Serializable Any> DataStorePreferencesStorage(dataStore: DataStore<Preferences>, cacheStrategy: CacheStrategy = CacheStrategy.NO_CACHE): StorageDelegate<T>(source)

Creates a new Storage instance for storing serializable objects in DataStore Preferences.

Return

A new Storage instance.

Parameters

dataStore

The DataStore instance to use for storing the preferences.

cacheStrategy

The caching strategy for the storage. Defaults to CacheStrategy.NO_CACHE.

Type Parameters

T

The type of the object to be stored. Must be serializable.