set<T extends Object> method
Saves or replaces a value for a key.
Implementation
Future<void> set<T extends Object>(String key, T value) async {
if (value is int) {
await _sharedPreferences.setInt('${_prefix}_$key', value);
return;
}
if (value is double) {
await _sharedPreferences.setDouble('${_prefix}_$key', value);
return;
}
if (value is bool) {
await _sharedPreferences.setBool('${_prefix}_$key', value);
return;
}
if (value is String) {
await _sharedPreferences.setString('${_prefix}_$key', value);
return;
}
throw ArgumentError('Type ${value.runtimeType} is not supported.');
}