protected<T extends Enum> static method
Implementation
static Future<TSharedprotectedEnumPod<T>> protected<T extends Enum>(
String key,
Iterable<T?> options, {
T? initialValue,
}) async {
final instance = TSharedprotectedEnumPod<T>(
key,
fromValue: (value) {
return options.firstWhere(
(e) => e?.name.toLowerCase() == value?.toLowerCase(),
orElse: () => null,
);
},
toValue: (rawValue) => rawValue?.name,
initialValue: initialValue,
);
await instance.refresh();
return instance;
}