throwInstead function
Returns a Validator that throws a ValidatorFailedException instead of returning a result
Implementation
Validator throwInstead(Validator validator) {
return (value) {
final result = validator(value);
if (result.isNotValid) throw ValidatorFailedException(result);
return Result.valid;
};
}