getCardByArenaId method

Future<MtgCard> getCardByArenaId(
  1. int arenaId
)

GET /cards/arena/:id

Returns a single card with the given arenaId (Magic: The Gathering Arena ID).

Implementation

Future<MtgCard> getCardByArenaId(int arenaId) async {
  final url = Uri.https(_baseUrl, '/cards/arena/$arenaId');
  final response = await _httpClient.get(url);

  final json = jsonDecode(response.body) as Map<String, dynamic>;

  if (response.statusCode != 200) {
    throw ScryfallException.fromJson(json);
  }

  return MtgCard.fromJson(json);
}