getTopArtists method
Get the top artists chart.
Implementation
Future<List<Artist>?> getTopArtists({int page = 1, int limit = 50}) async {
final parameters = {'page': page, 'limit': limit};
final request = Request(
api: _api,
method: 'chart.getTopArtists',
parameters: parameters,
);
final response = await request.send(mode: RequestMode.GET);
final topArtists = response['artists']['artist'];
return topArtists == null
? null
: List.generate(
(topArtists as List).length,
(i) => Artist.fromJson(topArtists[i]),
);
}