operator ^ method

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

Combines this spec with another using XOR logic (^).

Returns a new spec that is satisfied when exactly one of this spec or other is satisfied, but not both. Use this for mutually exclusive conditions. Shorthand for calling xor.

Example:

// Exactly one must be true, not both
final exclusive = IsStudent() ^ IsWorking();
final status = IsActive() ^ IsArchived(); // Not both, one required

Implementation

Spec<T> operator ^(Spec<T> other) => _Xor(this, other);