passwordStrengthFeedback property
String
get
passwordStrengthFeedback
Implementation
String get passwordStrengthFeedback {
if (length < 8) {
return "Password too short, must be at least 8 characters.";
} else if (!RegExp(r'[A-Z]').hasMatch(this)) {
return "Password must contain at least one uppercase letter.";
} else if (!RegExp(r'[a-z]').hasMatch(this)) {
return "Password must contain at least one lowercase letter.";
} else if (!RegExp(r'\d').hasMatch(this)) {
return "Password must contain at least one number.";
} else if (!RegExp(r'[!@#$%^&*(),.?":{}|<>]').hasMatch(this)) {
return "Password must contain at least one special character.";
} else {
return "Password is strong!";
}
}