Preferences
Serializes and deserializes class properties into SharedPreferences consisting of string keys and primitive type values.
@Serializable
data class Person(val name: String, val age: Int)
val preferences = Preferences(sharedPreferences)
val abby = Person("Abby", 20)
preferences.encode("person", abby)
assertEquals("Abby", sharedPreferences.getString("person.name", null))
assertEquals(20, sharedPreferences.getInt("person.age", 0))
Properties
Contains all serializers registered by format user for Contextual and Polymorphic serialization.
Functions
Encodes changes to the delegated property into the SharedPreferences and decodes the current value from them.
Decodes and deserializes from the SharedPreferences at the specified tag to the value of type T using the given deserializer
Decodes and deserializes from the SharedPreferences at the specified tag to the value of type T using deserializer retrieved from the reified type parameter.
Decodes and deserializes from the SharedPreferences at the specified tag to the value of type T using the given deserializer
Decodes and deserializes from the SharedPreferences at the specified tag to the value of type T using deserializer retrieved from the reified type parameter.
Serializes and encodes the given value into the SharedPreferences at the specified tag using the given serializer.
Serializes and encodes the given value into the SharedPreferences at the specified tag using serializer retrieved from the reified type parameter.