Google is committed to advancing racial equity for Black communities. See how.

Key

class Key<T>
kotlin.Any
   ↳ androidx.datastore.preferences.core.Preferences.Key

Key for values stored in Preferences. Type T is the type of the value associated with the Key.

T must be one of the following: Boolean, Int, Long, Float, String, Set.

Construct Keys for your data type using: preferencesKey, preferencesSetKey.

Summary

Public methods
Boolean
equals(other: Any?)

Int

infix Preferences.Pair<T>
to(value: T)

Infix function to create a Preferences.

Properties
String

Public methods

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

to

infix fun to(value: T): Preferences.Pair<T>

Infix function to create a Preferences.Pair. This is used to support preferencesOf and MutablePreferences.putAll

Parameters
value: T is the value this preferences key should point to.

Properties

name

val name: String