PreferencesKeys

class PreferencesKeys


Summary

Public constructors

Public functions

const Preferences.Key<Boolean>

Get a key for a Boolean preference.

const Preferences.Key<Double>
doubleKey(name: String!)

Get a key for a Double preference.

const Preferences.Key<Float>
floatKey(name: String!)

Get a key for a Float preference.

const Preferences.Key<Int>
intKey(name: String!)

Get a key for an Int preference.

const Preferences.Key<Long>
longKey(name: String!)

Get a key for an Long preference.

const Preferences.Key<String>
stringKey(name: String!)

Get a key for a String preference.

const Preferences.Key<Set<String>>

Get a key for a String Set preference.

Public constructors

PreferencesKeys

PreferencesKeys()

Public functions

booleanKey

const fun booleanKey(name: String!): Preferences.Key<Boolean>

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.

Parameters
name: String!

the name of the preference

Returns
Preferences.Key<Boolean>

the Preferences.Key for name

doubleKey

const fun doubleKey(name: String!): Preferences.Key<Double>

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.

Parameters
name: String!

the name of the preference

Returns
Preferences.Key<Double>

the Preferences.Key for name

floatKey

const fun floatKey(name: String!): Preferences.Key<Float>

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.

Parameters
name: String!

the name of the preference

Returns
Preferences.Key<Float>

the Preferences.Key for name

intKey

const fun intKey(name: String!): Preferences.Key<Int>

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.

Parameters
name: String!

the name of the preference

Returns
Preferences.Key<Int>

the Preferences.Key for name

longKey

const fun longKey(name: String!): Preferences.Key<Long>

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.

Parameters
name: String!

the name of the preference

Returns
Preferences.Key<Long>

the Preferences.Key for name

stringKey

const fun stringKey(name: String!): Preferences.Key<String>

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.

Parameters
name: String!

the name of the preference

Returns
Preferences.Key<String>

the Preferences.Key for name

stringSetKey

const fun stringSetKey(name: String!): Preferences.Key<Set<String>>

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.

Note: sets returned by DataStore are unmodifiable and will throw exceptions if mutated.

Parameters
name: String!

the name of the preference

Returns
Preferences.Key<Set<String>>

the Preferences.Key> for name