save method

Future<void> save()

Store the current $ at key in shared preferences.

Implementation

Future<void> save() async {
  if (customSave == null) {
    assert(key != null);
    final toSave = serialize(_value);
    final pref = await SharedPreferences.getInstance();
    if (toSave == null) {
      await pref.remove(key!);
    } else {
      await pref.setString(key!, toSave);
    }
  } else {
    await customSave!(_value);
  }
}