all function
- List<
IValidator> validators
Passes the test if all of the Validators are valid, and fails if any of them are invalid
In the case that a Validator fails, it's Result will be returned
Implementation
IValidator all(List<IValidator> validators) => Validator<Result>(
(value) {
for (var i = 0; i < validators.length; i++) {
final resOr = validators[i].validator(value);
if (resOr is Future<Result>) {
return _allAsync(value, validators, i, resOr);
}
final res = resOr;
if (res.isNotValid) return res;
}
return Result.valid(value);
},
);