username static method
FormFieldValidator that requires the field's value to be a valid username.
Parameters:
minLengthThe minimum length of the username (default: 3).maxLengthThe maximum length of the username (default: 32).allowNumbersWhether digits are allowed (default: true).allowUnderscoreWhether underscores are allowed (default: false).allowDotsWhether dots are allowed (default: false).allowDashWhether dashes are allowed (default: false).allowSpaceWhether spaces are allowed (default: false).allowSpecialCharWhether special characters are allowed (default: false).errorTextThe error message when the username is invalid.checkNullOrEmptyWhether 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;