NotContainsValidator<T> class
A validator that checks if the value NOT contains notContain.
The NotContainsValidator can be used with FieldControllers holding
values of types String, Iterable or Map. It ensures that the
value NOT contains notContain.
If the value is null it is treated as valid by default.
Properties
- notContain: The value that the field should NOT contain.
- message: An optional custom error message to display when invalid.
Example
FieldController<int> field = FieldController(
key: 'name',
validators:[NotContainsValidator('Bye')],
);
// If field.value = 'Bye World :( )', 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<
T> - NotContainsValidator
Constructors
- NotContainsValidator(dynamic notContain, {String? message})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- message → String?
-
finalinherited
- notContain → dynamic
-
The value that the field value should NOT contain.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call(
FieldController< T> controller) → ValidationResult -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onValidate(
FieldController< T> controller) → ValidationResult -
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited