fromScore static method

RiskLevel fromScore(
  1. double score
)

Maps a numeric score in 0, 100 to the corresponding RiskLevel.

Implementation

static RiskLevel fromScore(double score) {
  if (score <= 20) return healthy;
  if (score <= 40) return low;
  if (score <= 60) return warning;
  if (score <= 80) return risky;
  return critical;
}