getCardDetails static method

Future<MtgCard> getCardDetails(
  1. String cardId
)

Implementation

static Future<MtgCard> getCardDetails(String cardId) async {
  if (_scryfallCardCache.containsKey(cardId)) {
    return _scryfallCardCache[cardId]!;
  }

  try {
    MtgCard card = await _apiClient.getCardById(cardId);
    _scryfallCardCache[cardId] = card;
    return card;
  } catch (e) {
    throw Exception("Failed to fetch card details for ID '$cardId': $e");
  }
}