DataStoreProvider

abstract class DataStoreProvider(context: Context) : IDataStoreProvider

Inheritors

Constructors

Link copied to clipboard
protected constructor(context: Context)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Always use applicationContext to prevent memory leaks when Activity contexts are passed. Static references (like Braze.sdkEnablementProvider) would otherwise retain destroyed Activities.

Link copied to clipboard
internal val dataStoreScope: CoroutineScope

Functions

Link copied to clipboard
open override fun batchUpdate(updates: Map<String, Any>, removals: Set<String>)
Link copied to clipboard
internal fun batchUpdates(updates: Map<String, Any>, removals: Set<String>)

Performs batch updates and removals on the DataStore.

Link copied to clipboard
internal fun <T> clear(key: ERROR CLASS: Symbol not found for Preferences.Key<T>)
Link copied to clipboard
Link copied to clipboard
open override fun clearAllData()
Link copied to clipboard
open override fun clearData(key: DataStoreKey)
Link copied to clipboard
internal fun <T : Any> contains(key: ERROR CLASS: Symbol not found for Preferences.Key<T>): Boolean
open override fun contains(key: DataStoreKey): Boolean
Link copied to clipboard
protected fun createOrGetDataStore(migrations: List<ERROR CLASS: Symbol not found for DataMigration<ERROR CLASS: Symbol not found for Preferences>> = emptyList()): ERROR CLASS: Symbol not found for DataStore<ERROR CLASS: Symbol not found for Preferences>

Helper to create or return an existing DataStore with proper scope management for a given filename.

Link copied to clipboard
abstract fun getDataStore(): androidx/datastore/core/DataStore<androidx/datastore/preferences/core/Preferences>
Link copied to clipboard
Link copied to clipboard
private fun publishException(message: String, throwable: Throwable)
Link copied to clipboard
internal fun <T : Any> read(key: ERROR CLASS: Symbol not found for Preferences.Key<T>, defaultValue: T?): T?
Link copied to clipboard
internal fun readAll(): Map<ERROR CLASS: Symbol not found for Preferences.Key<*>, Any>
Link copied to clipboard
open override fun readAllData(): Map<ERROR CLASS: Symbol not found for Preferences.Key<*>, Any>
Link copied to clipboard
open override fun readBoolean(key: DataStoreKey, default: Boolean?): Boolean?
Link copied to clipboard
open override fun readData(key: DataStoreKey, default: Any?): Any?
Link copied to clipboard
open override fun readFloat(key: DataStoreKey, default: Float?): Float?
Link copied to clipboard
open override fun readInt(key: DataStoreKey, default: Int?): Int?
Link copied to clipboard
inline fun <T> readList(key: DataStoreKey): MutableList<T>

Reads a list from DataStore.

Link copied to clipboard
open override fun readLong(key: DataStoreKey, default: Long?): Long?
Link copied to clipboard
inline fun <K, V> readMap(key: DataStoreKey): MutableMap<K, V>

Reads a map from DataStore.

Link copied to clipboard
open override fun readString(key: DataStoreKey, default: String?): String?
Link copied to clipboard
internal fun <T> write(key: ERROR CLASS: Symbol not found for Preferences.Key<T>, value: T)
Link copied to clipboard
open override fun writeData(key: DataStoreKey, value: Any)
Link copied to clipboard
inline fun <T> writeList(key: DataStoreKey, list: List<T>)

Writes a list to DataStore.

Link copied to clipboard
inline fun <K, V> writeMap(key: DataStoreKey, map: Map<K, V>)

Writes a map to DataStore.