load method

Future<void> load()

Try to load the value stored at key in shared preferences. If no value is found, return immediately. Else, update $ and rebuild dependent widgets if it changed.

Implementation

Future<void> load() async {
  if (customLoad == null) {
    assert(key != null);
    final pref = await SharedPreferences.getInstance();
    final str = pref.getString(key!);
    if (str == null && customDecode == null) return;
    $ = deserialize(str);
  } else {
    $ = await customLoad!();
  }
}