PlayableCard constructor

PlayableCard({
  1. required CardSet cardSet,
  2. required int orderInSet,
  3. required String name,
  4. required Set<Aspect> aspects,
  5. required int cost,
  6. required Set<Trait> traits,
  7. bool unique = false,
})

Creates a playable card with the given properties.

Errors

This class is not intended to be used with user-provided input, and as such does not provide any error handling. If any of the fields are invalid, an error will be thrown.

Implementation

PlayableCard({
  required super.cardSet,
  required super.orderInSet,
  required super.name,
  required super.aspects,
  required this.cost,
  required this.traits,
  super.unique,
}) {
  RangeError.checkNotNegative(cost, 'cost');
  RangeError.checkValueInInterval(
    traits.length,
    1,
    4,
    'traits.length',
  );
}