update method

Future<void> update(
  1. T value
)

Updates the value asynchronously.

Implementation

Future<void> update(T value) async {
  if (value is String) {
    await prefs.setString(prefKey, value);
  } else if (value is bool) {
    await prefs.setBool(prefKey, value);
  } else if (value is int) {
    await prefs.setInt(prefKey, value);
  } else if (value is double) {
    await prefs.setDouble(prefKey, value);
  } else if (value is List<String>) {
    await prefs.setStringList(prefKey, value);
  }
  super.state = value;
}