state static method
FormFieldValidator that requires the field's value to be a valid state.
Parameters:
regex
The regex pattern to match.stateWhitelist
The list of allowed states.stateBlacklist
The list of disallowed states.errorText
The error message when the state is invalid.checkNullOrEmpty
Whether to check for null or empty values.
Implementation
static FormFieldValidator<String> state({
RegExp? regex,
List<String> stateWhitelist = const <String>[],
List<String> stateBlacklist = const <String>[],
String? errorText,
bool checkNullOrEmpty = true,
}) => StateValidator(
regex: regex,
stateWhitelist: stateWhitelist,
stateBlacklist: stateBlacklist,
errorText: errorText,
checkNullOrEmpty: checkNullOrEmpty,
).validate;