Initializes JSON decoders
for custom types
(if you ever need to store anything custom in shared preferences),
so they can be easily
restored from SharedPreferences.
Call this method someplace at the beginning of
your app, just before you initialize LiteState controllers
so that controllers can have access to this data before
they are initialized themselves.
Decoder MUST be a STATIC function
that creates instances of custom classes
from a map
e.g.
static AuthData decode(Map map) {
return AuthData(
type: map'type',
token: map'token',
userName: map'userName',
);
}
this function converts a Map, stored in SharedPreferences
into a user defined object. In this case a custom class
called AuthData