PreferencesKeys
class PreferencesKeys
Summary
Public constructors |
|
---|---|
Public functions |
|
---|---|
const Preferences.Key<Boolean> |
booleanKey(name: String!) Get a key for a Boolean preference. |
const Preferences.Key<Double> |
Get a key for a Double preference. |
const Preferences.Key<Float> |
Get a key for a Float preference. |
const Preferences.Key<Int> |
Get a key for an Int preference. |
const Preferences.Key<Long> |
Get a key for an Long preference. |
const Preferences.Key<String> |
Get a key for a String preference. |
const Preferences.Key<Set<String>> |
stringSetKey(name: String!) Get a key for a String Set preference. |
Public constructors
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 |
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 |
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 |
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 |
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 |
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 |
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 |