setEnum<E extends Enum> method
Saves an enum value of type E with the given key.
This method stores an enum value by its name, associating it with the specified key. If a value already exists for this key, it will be replaced.
Parameters:
key: The unique identifier for the enum value.value: The enum value to store.
Returns a Future that completes when the enum value has been successfully stored.
Throws:
- ArgumentError if the key is invalid.
Implementation
@override
Future<void> setEnum<E extends Enum>(String key, E value) async {
validateKey(key);
await backend.setString(encodeKey(key), value.name);
notifyListeners(key);
}