editValue<T> static method
- String key,
- T update(
- T
Implementation
static Future<void> editValue<T>(String key, T Function(T) update) async {
final currentValue = getValue<T>(key);
final newValue = update(currentValue);
if (newValue != null) {
await setValue<T>(key, newValue);
} else {
await deleteValue(key);
}
}