valueOf method
Returns the first element or null
if there are none.
Example:
enum ExampleEnum { a, b, c }
final value = ExampleEnum.values.valueOf('b');
print(ExampleEnum.b == value); // true
Implementation
T? valueOf(String? value) {
return firstWhereOrNull(
(type) => type.name.toLowerCase() == value?.toLowerCase(),
);
}