getRulingsById method
GET /cards/:id/rulings
Returns a PaginableList
of Rulings for a card with the
given id
on Scryfall.
Implementation
Future<PaginableList<Ruling>> getRulingsById(String id) async {
final url = Uri.https(_baseUrl, '/cards/$id/rulings');
final response = await _httpClient.get(url);
final json = jsonDecode(response.body) as Map<String, dynamic>;
if (response.statusCode != 200) {
throw ScryfallException.fromJson(json);
}
return PaginableList.fromJson(
json,
(ruling) => Ruling.fromJson(ruling as Map<String, dynamic>),
);
}