validators/combinator library

Combinator Validators

This file contains validators for combining multiple validation rules.

Functions

all(List<IValidator> validators, {String? message, bool collecting = false}) AllValidator
Passes the test if all of the Validators are valid, and fails if any of them are invalid
any(List<IValidator> validators, {String? message}) IValidator
Passes the test if any of the Validators are valid, and fails if any are invalid
none(List<IValidator> validators, {String? message}) IValidator
Passes the test if none of the validators pass
not(IValidator child, {String? message}) IValidator
Passes the test if the child validator is not valid
throwInstead(IValidator validator) IValidator
Returns a Validator that throws a ValidatorFailedException instead of returning a result
withExpectation(IValidator child, Expectation error, {String? message}) IValidator
Returns a IValidator that wraps the given child validator and adds the provided error message to the result if the validation fails. Preserves the underlying child's code and data (if the child failed). See docs/expectation_codes.md.