Card.fromInt constructor

Card.fromInt(
  1. int cardId
)

Implementation

factory Card.fromInt(int cardId) {
  if (cardId >= 52) {
    return const Card(value: 0, suit: 0);
  }
  return Card(value: cardId % 13 + 1, suit: (cardId / 13).floor());
}