or method
Implementation
Validation<T> or(Validation<T> otherValidation) {
return Validation(
(target, package, addViolation) {
final thisViolations = <String>[];
final otherViolations = <String>[];
validation(target, package, thisViolations.add);
otherValidation(target, package, otherViolations.add);
final violatesBoth =
thisViolations.isNotEmpty && otherViolations.isNotEmpty;
if (violatesBoth) {
(thisViolations + otherViolations).forEach(addViolation);
}
},
description: '$description OR ${otherValidation.description}',
);
}