checkPasswordStrength static method
Password strength validation with comprehensive scoring
Evaluates password strength based on length, character variety, and complexity.
Performance: O(n) where n is password length
Example:
final strength = FSValidators.checkPasswordStrength('SecurePass123!');
print(strength.name); // 'Strong'
Implementation
static FSPasswordStrength checkPasswordStrength(String password) {
if (password.length < 6) return FSPasswordStrength.weak;
final checks = [
RegExp(r'[A-Z]').hasMatch(password), // Uppercase letters
RegExp(r'[a-z]').hasMatch(password), // Lowercase letters
RegExp(r'[0-9]').hasMatch(password), // Numbers
RegExp(r'[!@#$%^&*(),.?":{}|<>]').hasMatch(password), // Special chars
password.length >= 12, // Length bonus
password.length >= 16, // Extra length bonus
];
final score = checks.where((check) => check).length;
// Enhanced scoring logic
if (score >= 5) return FSPasswordStrength.strong;
if (score >= 3) return FSPasswordStrength.medium;
return FSPasswordStrength.weak;
}