username static method

FormFieldValidator<String> username({
  1. int minLength = 3,
  2. int maxLength = 32,
  3. bool allowNumbers = true,
  4. bool allowUnderscore = false,
  5. bool allowDots = false,
  6. bool allowDash = false,
  7. bool allowSpace = false,
  8. bool allowSpecialChar = false,
  9. String? errorText,
  10. bool checkNullOrEmpty = true,
})

FormFieldValidator that requires the field's value to be a valid username.

Parameters:

  • minLength The minimum length of the username (default: 3).
  • maxLength The maximum length of the username (default: 32).
  • allowNumbers Whether digits are allowed (default: true).
  • allowUnderscore Whether underscores are allowed (default: false).
  • allowDots Whether dots are allowed (default: false).
  • allowDash Whether dashes are allowed (default: false).
  • allowSpace Whether spaces are allowed (default: false).
  • allowSpecialChar Whether special characters are allowed (default: false).
  • errorText The error message when the username is invalid.
  • checkNullOrEmpty Whether to check for null or empty values.

Implementation

static FormFieldValidator<String> username({
  int minLength = 3,
  int maxLength = 32,
  bool allowNumbers = true,
  bool allowUnderscore = false,
  bool allowDots = false,
  bool allowDash = false,
  bool allowSpace = false,
  bool allowSpecialChar = false,
  String? errorText,
  bool checkNullOrEmpty = true,
}) => UsernameValidator(
  minLength: minLength,
  maxLength: maxLength,
  allowNumbers: allowNumbers,
  allowUnderscore: allowUnderscore,
  allowDots: allowDots,
  allowDash: allowDash,
  allowSpace: allowSpace,
  allowSpecialChar: allowSpecialChar,
  errorText: errorText,
  checkNullOrEmpty: checkNullOrEmpty,
).validate;