isPasswordField static method
Validator to check if a field contains a valid password.
The password must be at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one number, and one special character.
The validator checks whether the provided value is non-null, is a non-empty
string, and matches the format of a password. If the validation fails,
an error message 'error.field.password'
is returned.
Implementation
static ValidatorEvent isPasswordField() => (value) async {
var res = (value != null && value.toString().trim().isPassword);
return FieldValidateResult(
success: res,
error: res ? '' : 'error.field.password',
);
};