Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
open class DataStoreKeyNamespace(prefix: String = "")
Link copied to clipboard
sealed interface DataStoreValue<out T>

Wrapper for values emitted by mutableStateFlow. Because DataStore can only be read asynchronously, these state flows can't be initialized with a real value; Uninitialized distinguishes that startup state from a genuine read of an absent key (which emits Loaded with a null value).

Link copied to clipboard

Properties

Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
fun <T> DataStore<Preferences>.flow(key: DataStoreKey<T, *>): Flow<T>
Link copied to clipboard
suspend fun <T> DataStore<Preferences>.get(key: DataStoreKey<T, *>): T
suspend fun <T> DataStoreValueGetter.get(key: DataStoreKey<T, *>): T
Link copied to clipboard
Link copied to clipboard
fun DataStore<Preferences>.launchEdit(scope: CoroutineScope, action: suspend TypedMutablePreferences.() -> Unit): Job
Link copied to clipboard
Link copied to clipboard
fun <T> DataStore<Preferences>.mutableStateFlow(key: DataStoreKey<T, *>, scope: CoroutineScope, debounceWrites: Duration = Duration.ZERO): MutableStateFlow<DataStoreValue<T>>

Returns a MutableStateFlow that starts as DataStoreValue.Uninitialized, reflects the latest value of key as DataStoreValue.Loaded emissions, and persists any DataStoreValue.Loaded values set on it (a loaded null value removes the entry; setting DataStoreValue.Uninitialized is a no-op on the store).

Link copied to clipboard
fun <T> DataStore<Preferences>.property(key: DataStoreKey<T, *>, scope: CoroutineScope): DelegateProperty<T?>

Returns a nullable property delegate backed by mutableStateFlow; it reads null until the first value is loaded from the store, and setting null removes the entry.

Link copied to clipboard
Link copied to clipboard
suspend fun <T> DataStore<Preferences>.set(key: DataStoreKey<T, *>, value: T)
suspend fun <T> DataStoreValueSetter.set(key: DataStoreKey<T, *>, value: T)
Link copied to clipboard
suspend fun <T> DataStore<Preferences>.update(key: DataStoreKey<T, *>, reducer: suspend (T) -> T)