none function
- List<
IValidator> validators
Passes the test if none of the validators pass
Implementation
IValidator none(List<IValidator> validators) => Validator<Result>(
(value) {
final expectations = <Expectation>[];
for (var i = 0; i < validators.length; i++) {
final resOr = not(validators[i]).validator(value);
if (resOr is Future<Result>) {
return _noneAsync(value, validators, expectations, i, resOr);
}
if (resOr.isNotValid) expectations.addAll(resOr.expectations);
}
return expectations.isNotEmpty
? Result.invalid(value, expectations: expectations)
: Result.valid(value);
},
);