parse static method

Parses a string into a RootCauseConfidence. Throws FormatException if val is not a valid confidence string.

Implementation

static RootCauseConfidence parse(String val) {
  return switch (val.trim().toLowerCase()) {
    'high' => RootCauseConfidence.high,
    'medium' => RootCauseConfidence.medium,
    'low' => RootCauseConfidence.low,
    'unknown' => RootCauseConfidence.unknown,
    _ => throw FormatException('Invalid RootCauseConfidence value: "$val"'),
  };
}