toNegated method
Creates a new spec that is the logical negation of this spec.
Returns a new spec that is satisfied when this spec is NOT satisfied. Use this to invert rules without creating separate negation specs.
Example:
final notAdult = IsAdult().toNegated();
final inactive = IsActive().toNegated();
final notPremium = IsPremium().toNegated();
Implementation
Spec<T> toNegated() => _Not(this);