-
public final class PreferencesKt
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any> Unitencode(Preferences $self, String tag, T value)Serializes and encodes the given value into the SharedPreferences at the specified tag using serializer retrieved from the reified type parameter. final static <T extends Any> Tdecode(Preferences $self, String tag)Decodes and deserializes from the SharedPreferences at the specified tag to the value of type T using deserializer retrieved from the reified type parameter. final static PreferencesPreferences(SharedPreferences sharedPreferences, Function1<PreferencesBuilder, Unit> builderAction)Creates an instance of Preferences encoding and decoding data from the given SharedPreferences and adjusted with builderAction. final static PreferencesPreferences(Preferences preferences, Function1<PreferencesBuilder, Unit> builderAction)Creates an instance of Preferences using the configuration of the previous created Preferences and adjusted with builderAction. -
-
Method Detail
-
encode
final static <T extends Any> Unit encode(Preferences $self, String tag, T value)
Serializes and encodes the given value into the SharedPreferences at the specified tag using serializer retrieved from the reified type parameter.
- Parameters:
tag- key to encode data tovalue- value to encode
-
decode
final static <T extends Any> T decode(Preferences $self, String tag)
Decodes and deserializes from the SharedPreferences at the specified tag to the value of type T using deserializer retrieved from the reified type parameter.
- Parameters:
tag- key to decode data from
-
Preferences
final static Preferences Preferences(SharedPreferences sharedPreferences, Function1<PreferencesBuilder, Unit> builderAction)
Creates an instance of Preferences encoding and decoding data from the given SharedPreferences and adjusted with builderAction.
- Parameters:
sharedPreferences- the storage to encode data into and decode data frombuilderAction- builder to change the behavior of the Preferences format
-
Preferences
final static Preferences Preferences(Preferences preferences, Function1<PreferencesBuilder, Unit> builderAction)
Creates an instance of Preferences using the configuration of the previous created Preferences and adjusted with builderAction.
- Parameters:
preferences- format to copy the configuration frombuilderAction- builder to change the behavior of the Preferences format
-
-
-
-