score property
double
score
Score of the password depending of the ValidationRules.
Score value is between 0.0 and 1.0.
1.0 is the maximum score, meaning all rules are fully respected.
Implementation
double get score {
int totalRulesImpact = passwordPolicy.validationRules
.map<int>((rule) => rule.impact)
.fold(0, (a, b) => a + b);
double totalAppliedImpact = passwordPolicy.validationRules
.map<double>((rule) => rule.impact * rule.computeRuleScore(password))
.fold(0, (a, b) => a + b);
return totalAppliedImpact / totalRulesImpact;
}