DataStorePreferencesStorage

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

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

Return

A new Storage instance.

Parameters

T

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

dataStore

The DataStore instance to use for storing the preferences.

cacheable

Whether the storage should cache the object in memory.