operator & method

Spec<T> operator &(
  1. Spec<T> other
)

Combines this spec with another using AND logic (&).

Returns a new spec that is satisfied only when both this spec and other are satisfied by the candidate. Use this when all conditions must be true. Shorthand for calling and.

Example:

// All conditions must be met
final youngAdult = IsAdult() & IsYoung();
final premium = IsPaid() & HasNoDebts() & IsActive();

Implementation

Spec<T> operator &(Spec<T> other) => _And(this, other);