OrValidator class

A validator that checks if the value passes in at least one FormyValidator.

The OrValidator can be used with FieldControllers holding values of any types. It ensures that the value passes in at least one FormyValidator

Properties

Example

FieldController<String> field = FieldController(
  key: 'name',
  validators:[
    PatternValidator(RegExp(r'[^[0-9]+$')),
    EmailValidator(),
  ]
);

// If field.value = 'Maria', validation fails.
// If field.value = 'maria@email.com', validation passes.
// If field.value = '123456', validation passes.

See also

Inheritance

Constructors

OrValidator.new(List<FormyValidator> validators, {required String? message})

Properties

hashCode int
The hash code for this object.
no setterinherited
message String?
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
validators List<FormyValidator>
List of FormyValidator that the value must pass in at least one.
final

Methods

call(FieldController controller) ValidationResult
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onValidate(FieldController controller) ValidationResult
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited