Package-level declarations

Types

Link copied to clipboard

Mutable version of Preferences. Allows for creating Preferences with different key-value pairs.

Link copied to clipboard

Public factory for creating PreferenceDataStore instances.

Link copied to clipboard
abstract class Preferences

Preferences and MutablePreferences are a lot like a generic Map and MutableMap keyed by the Preferences.Key class. These are intended for use with DataStore. Construct a DataStore instance using PreferenceDataStoreFactory.create.

Functions

Link copied to clipboard

Get a key for a Boolean preference. You should not have multiple keys with the same name (for use with the same Preferences). Using overlapping keys with different types can result in ClassCastException.

Link copied to clipboard

Get a key for an ByteArray preference. You should not have multiple keys with the same name (for use with the same Preferences). Using overlapping keys with different types can result in ClassCastException.

Link copied to clipboard

Get a key for a Double preference. You should not have multiple keys with the same name (for use with the same Preferences). Using overlapping keys with different types can result in ClassCastException.

Link copied to clipboard
suspend fun DataStore<Preferences>.edit(transform: suspend (MutablePreferences) -> Unit): Preferences

Edit the value in DataStore transactionally in an atomic read-modify-write operation. All operations are serialized.

Link copied to clipboard

Get a new empty Preferences.

Link copied to clipboard

Get a key for a Float preference. You should not have multiple keys with the same name (for use with the same Preferences). Using overlapping keys with different types can result in ClassCastException.

Link copied to clipboard

Get a key for an Int preference. You should not have multiple keys with the same name (for use with the same Preferences). Using overlapping keys with different types can result in ClassCastException.

Link copied to clipboard

Get a key for an Long preference. You should not have multiple keys with the same name (for use with the same Preferences). Using overlapping keys with different types can result in ClassCastException.

Link copied to clipboard

Construct a MutablePreferences object with a list of Preferences.Pair. Comparable to mapOf().

Link copied to clipboard

Construct a Preferences object with a list of Preferences.Pair. Comparable to mapOf().

Link copied to clipboard

Get a key for a String preference. You should not have multiple keys with the same name (for use with the same Preferences). Using overlapping keys with different types can result in ClassCastException.

Link copied to clipboard

Get a key for a String Set preference. You should not have multiple keys with the same name (for use with the same Preferences). Using overlapping keys with different types can result in ClassCastException.