findCopies method

({Card card, int count}) findCopies(
  1. CardSet cardSet,
  2. int orderInSet
)

Looks up a card in this collection by its cardSet and orderInSet.

If the card is not found, throws a StateError.

NOTE: This method is not highly optimized.

Implementation

({Card card, int count}) findCopies(CardSet cardSet, int orderInSet) {
  final (:card, :count) = tryFindCopies(cardSet, orderInSet);
  if (card != null) {
    return (card: card, count: count);
  }
  throw StateError('Card not found: $cardSet $orderInSet');
}