setEnum<E extends Enum> method

  1. @override
Future<void> setEnum<E extends Enum>(
  1. String key,
  2. E value
)
override

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:

Implementation

@override
Future<void> setEnum<E extends Enum>(String key, E value) async {
  validateKey(key);
  await backend.setString(encodeKey(key), value.name);
  notifyListeners(key);
}