and method

Validated<T> and(
  1. Validated<T> other
)

Combines two validation results, merging their errors.

Implementation

Validated<T> and(Validated<T> other) => switch ((this, other)) {
  (Valid(), _) => other,
  (Invalid(errors: final e1), Invalid(errors: final e2)) => .invalid({
    ...e1,
    ...e2,
  }),
  (Invalid(), Valid()) => this,
};