passwordStrength property
int
get
passwordStrength
Implementation
int get passwordStrength {
if (isEmpty) return 0;
int score = 0;
if (length < 8) return 0;
if (RegExp(r'[A-Z]').hasMatch(this)) score++;
if (RegExp(r'[a-z]').hasMatch(this)) score++;
if (RegExp(r'[0-9]').hasMatch(this)) score++;
if (RegExp(r'[!@#\$%^&*(),.?":{}|<>]').hasMatch(this)) score++;
if (score <= 1) return 0; // Weak
if (score == 2) return 1; // Medium
if (score == 3) return 2; // Strong
return 3; // Very Strong
}