enumerated<T extends Enum> static method
Creates a new preference for an enum value.
This factory method sets up a Prf instance with an EnumAdapter for converting between the enum and its integer index representation.
key
is the key to store the preference under.values
is the list of all possible enum values, typically EnumType.values.defaultValue
is the value to use if no value exists for the key.
Implementation
static Prf<T> enumerated<T extends Enum>(
String key, {
required List<T> values,
T? defaultValue,
}) {
return Prf._withAdapter(
key,
adapter: EnumAdapter<T>(values),
defaultValue: defaultValue,
);
}