operator & method
- IValidator other
Combines two validators with a logical AND, same as using all
This is Sugar, it allows for more concise validator composition.
Implementation
IValidator operator &(IValidator other) {
if (this is AllValidator && other is AllValidator) {
final mv1 = this as AllValidator;
return mv1.copyWith(validators: {...mv1.validators, ...other.validators});
}
if (this is AllValidator) {
final mv = this as AllValidator;
return mv.copyWith(validators: {...mv.validators, other});
}
if (other is AllValidator) {
return other.copyWith(validators: {...other.validators, this});
}
return all([this, other]);
}