CardSetInventory constructor
Creates a new CardSetInventory for the given cardSet
with cards
.
While cards
does not need to be all the cards in cardSet
(i.e. due
to partial releases), every card in cards
must belong to cardSet
or an
error will be thrown.
Implementation
factory CardSetInventory(CardSet cardSet, Set<Card> cards) {
for (final card in cards) {
if (card.cardSet != cardSet) {
throw ArgumentError.value(
card,
'cards',
'$card ({$card.set}) does not belong to $cardSet',
);
}
}
return CardSetInventory._(
cardSet,
cards,
);
}