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