getSetById method

Future<MtgSet> getSetById(
  1. String id
)

GET /sets/:id

Returns a MtgSet with the given id.

Implementation

Future<MtgSet> getSetById(String id) async {
  final url = Uri.https(_baseUrl, '/sets/$id');
  final response = await _httpClient.get(url);

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

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

  return MtgSet.fromJson(json);
}