notContainSpacesValidator function
ValidatorsFunction<FormControl<String> >
notContainSpacesValidator({
- String message = 'Не должен содержать пробелы',
- dynamic eventType = ValidationEventTypes.Error,
Not contain spaces Не содержит проблелов
Implementation
ValidatorsFunction<FormControl<String>> notContainSpacesValidator(
{String message = 'Не должен содержать пробелы',
eventType = ValidationEventTypes.Error}) =>
(FormControl<String> control) async {
if (control.value == null ||
RegExp(r"\s").allMatches(control.value).isEmpty) {
return [];
}
return [
ValidationEvent(
key: notContainSpacesValidatorKey,
message: message,
type: eventType,
)
];
};