fromString static method
Parses a String into an ErrorSeverity instance.
- Returns
nullif the value is'none'(case-insensitive), indicating that the severity should be treated as disabled. - Returns the matching
ErrorSeverityif a match is found, ignoring case. - Returns
nullif the string does not match any known severity.
Implementation
static ErrorSeverity? fromString(String? value) {
if (value?.toUpperCase() == ErrorSeverity.NONE.name.toUpperCase()) {
return null;
}
return ErrorSeverity.values.firstWhereOrNull(
(severity) => severity.name.toUpperCase() == value?.toUpperCase(),
);
}