getCardByMultiverseId method

Future<MtgCard> getCardByMultiverseId(
  1. int multiverseId
)

GET /cards/multiverse/:id

Returns a single card with the given multiverseId.

If the card has multiple multiverse IDs, this method can find either of them.

Implementation

Future<MtgCard> getCardByMultiverseId(int multiverseId) async {
  final url = Uri.https(_baseUrl, '/cards/multiverse/$multiverseId');
  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);
}