computeRuleScore method

  1. @override
double computeRuleScore(
  1. String password
)
override

Calculate the score of the rule.

For example, in case of a length rule it will be: passwordLength / requiredPasswordLength

Must return a value between 0.0 and 1.0.

Implementation

@override
double computeRuleScore(String password) {
  if (doCheckForHorizontalWhitespaces) {
    return RegExp(r"[\s\v\h]").allMatches(password).isEmpty ? 1.0 : 0.0;
  } else {
    return RegExp(r"[\s\v]").allMatches(password).isEmpty ? 1.0 : 0.0;
  }
}