getSetByCode method
Get /sets/:code
Returns a MtgSet
with the given set code.
The code
can be either the code
or the mtgo_code
for the set.
Implementation
Future<MtgSet> getSetByCode(String code) async {
final url = Uri.https(_baseUrl, '/sets/$code');
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);
}