parseEnumCase static method
EnumNameCase?
parseEnumCase(
- String? enumValuesCaseStr
)
Implementation
static EnumNameCase? parseEnumCase(String? enumValuesCaseStr) {
EnumNameCase? enumValuesCase;
if (enumValuesCaseStr != null) {
final index = EnumNameCase.values.indexWhere(
(v) => v.toString().split('.').last == enumValuesCaseStr,
);
if (index != -1) {
enumValuesCase = EnumNameCase.values[index];
} else {
final errorMessage = 'enumValuesCase should be one of'
' ${EnumNameCase.values.map((e) => '"${e.toString().split('.').last}"').join(', ')}.'
' Got $enumValuesCaseStr.';
throw FormatException(errorMessage, enumValuesCase);
}
}
return enumValuesCase;
}