password property

List<ValidationRule> password
final

Validation rules for password fields.

Requires:

  • The password to be non-empty.
  • Minimum length of 8 characters.
  • At least one uppercase letter.
  • At least one special character from #?!@$%^&*-.

Implementation

static final List<ValidationRule> password = [
  Validators.required(message: 'Password is required'),
  Validators.minLength(
    8,
    message: 'Password must be at least 8 characters long',
  ),
  Validators.pattern(
    r'(?=.*[A-Z])',
    message: 'Password must have at least one uppercase character',
  ),
  Validators.pattern(
    r'(?=.*?[#?!@$%^&*-])',
    message: 'Password must have at least one special character',
  ),
];