Object
stored via []=
functionReturns null
if there's no serialized object corresponding to the given key
Make sure that the serialized object is serialize
or that it redefines
the appropriate methods. Refer to Serializable
documentation for further details
# Retrieve an `Object` stored via `[]=` function
#
# Returns `null` if there's no serialized object corresponding to the given key
# Make sure that the serialized object is `serialize` or that it redefines
# the appropriate methods. Refer to `Serializable` documentation for further details
fun [](key: String): nullable Object
do
var serialized_string = self.string(key, "")
if serialized_string == "" then return null
var deserializer = new JsonDeserializer(serialized_string)
var deserialized = deserializer.deserialize
var errors = deserializer.errors
if errors.not_empty then
# An update may have broken the versioning compatibility
print_error "{class_name} error at deserialization: {errors.join(", ")}"
return null # Let's be safe
end
return deserialized
end
lib/android/shared_preferences/shared_preferences_api10.nit:388,2--410,4