NoNumbersValidator class
A validator that checks if the value doesn't contain any number.
The NoNumbersValidator can be used with FieldControllers holding
values of type String. It ensures that the
value is doesn't contain any number.
If the value is null it is treated as valid by default.
Properties
- message: An optional custom error message to display when invalid.
Example
FieldController<String> field = FieldController(
key: 'string',
validators:[NoNumbersValidator()],
);
// If field.value = '123', validation fails.
// If field.value = 'h3!!0 w0r!d', validation fails.
// If field.value = 'hello world 2', validation fails.
// If field.value = 'hello world', validation passes.
See also
- FormyValidator, the base class for custom validators.
- ValidationResult, which describes the outcome of validation.
- FieldController, which holds the field value to be validated.
- Inheritance
-
- Object
- FormyValidator<
String> - NoNumbersValidator
Constructors
- NoNumbersValidator({String? message})
Properties
Methods
-
call(
FieldController< String> controller) → ValidationResult -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onValidate(
FieldController< String> controller) → ValidationResult -
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited