hasSpecialChars static method
FormFieldValidator that requires the field's value to contain a minimum number of special characters.
Parameters:
atLeastThe minimum number of special characters (default: 1).regexThe regex pattern to match.errorTextThe error message when the value does not contain the required number of special characters.checkNullOrEmptyWhether to check for null or empty values.
This regex matches any character that is not a letter (A-Z, a-z) or a digit (0-9).
- It includes special characters and symbols.
- It can be used to find non-alphanumeric characters.
Examples: @, #, %
Implementation
static FormFieldValidator<String> hasSpecialChars({
int atLeast = 1,
RegExp? regex,
String? errorText,
bool checkNullOrEmpty = true,
}) => HasSpecialCharsValidator(
atLeast: atLeast,
regex: regex,
errorText: errorText,
checkNullOrEmpty: checkNullOrEmpty,
).validate;