Package 

Class AsPropertyKt

  • All Implemented Interfaces:

    
    public final class AsPropertyKt
    
                        
    • Constructor Detail

    • Method Detail

      • asProperty

         final static <T extends Any> ReadWriteProperty<Object, T> asProperty(Preferences $self, KSerializer<T> serializer, String tag)

        Encodes changes to the delegated property into the SharedPreferences and decodes the current value from them.

        var setting by preferences.asProperty(Boolean.serializer())
        Parameters:
        serializer - which encodes and decodes the value
        tag - optional tag which is used as SharedPreferences key - default to property name
      • asProperty

         final static <T extends Any> ReadWriteProperty<Object, T> asProperty(Preferences $self, KSerializer<T> serializer, String tag, T default)

        Encodes changes to the delegated property into the SharedPreferences and decodes the current value from them.

        var setting by preferences.asProperty(Boolean.serializer(), tag = "aSetting", default = false)
        Parameters:
        serializer - which encodes and decodes the value
        tag - optional tag which is used as SharedPreferences key - default to property name
        default - optional default value for not initialized preferences
      • asProperty

         final static <T extends Any> ReadWriteProperty<Object, T> asProperty(Preferences $self, String tag)

        Encodes changes to the delegated property into the SharedPreferences and decodes the current value from them.

        var setting: Boolean by preferences.asProperty()
        Parameters:
        tag - optional tag which is used as SharedPreferences key - default to property name
      • asProperty

         final static <T extends Any> ReadWriteProperty<Object, T> asProperty(Preferences $self, String tag, T default)

        Encodes changes to the delegated property into the SharedPreferences and decodes the current value from them.

        var setting: Boolean by preferences.asProperty(tag = "aSetting", default = false)
        Parameters:
        tag - optional tag which is used as SharedPreferences key - default to property name
        default - optional default value for not initialized preferences