Collection class final

A collection of cards that may span multiple CardSets.

This class is intended to be used to represent all of the cards that belong to a person or entity, e.g. a collection of all cards owned by a person, or all cards that are legal in a tournament.

Equality

Two Collections are equal if they contain the same cards, and the number of copies of each card is the same. This is a deep equalit check, so it should be used with caution.

Available Extensions
Annotations
  • @immutable

Constructors

Collection.fromCards(Iterable<Card> cards)
Creates a new Collection with the given cards.
factory
Collection.fromCardSets(Iterable<CardSetInventory> cardSets, {int count(Card) = _defaultCount})
Creates a new Collection containing the cards from each card set.
factory

Properties

allCards Iterable<Card>
Returns all of the cards in this collection.
latefinal
hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

contains(Card card) bool
Returns whether this collection contains at least one copy of card.
count(Card card) int
Returns the number of copies of card in this collection.
find(CardSet cardSet, int orderInSet) Card
Looks up a card in this collection by its cardSet and orderInSet.
findCopies(CardSet cardSet, int orderInSet) → ({Card card, int count})
Looks up a card in this collection by its cardSet and orderInSet.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDebugString() String
Returns a string representation of this object, suitable for debugging.
toMap() Map<CardSet, Map<Card, int>>
Returns a map of card sets to the number of cards in that set.
toSet() Set<Card>
Returns a set of all of the cards in this collection.
toString() String
A string representation of this object.
inherited
tryFind(CardSet cardSet, int orderInSet) Card?
Looks up a card in this collection by its cardSet and orderInSet.
tryFindCopies(CardSet cardSet, int orderInSet) → ({Card? card, int count})
Looks up a card in this collection by its cardSet and orderInSet.

Operators

operator ==(Object other) bool
The equality operator.
override
operator [](Card card) int
Returns the number of copies of card in this collection.