lookupBySimpleName method
Given a simpleName finds the corresponding enum value.
Throws an ArgumentError if simpleName is not valid.
The path is the path in the parent JSON structure at which this value
was found, and will be reported in any ArgumentErrors as the name.
Implementation
E lookupBySimpleName(String simpleName, {String? path}) {
final E? value = _nameToValue[simpleName];
if (value == null) {
throw ArgumentError.value(
simpleName,
path,
'Invalid enum value, valid values are ${_nameToValue.keys.join(', ')}',
);
}
return value;
}