getTopArtists method
Get the most popular artists on Last.fm by country.
Implementation
Future<List<Artist>?> getTopArtists({
required String country,
int page = 1,
int limit = 50,
}) async {
final parameters = {'country': country, 'page': page, 'limit': limit};
final request = Request(
api: _api,
method: 'geo.getTopArtists',
parameters: parameters,
);
final response = await request.send(mode: RequestMode.GET);
final topArtists = response['topartists']['artist'];
return topArtists == null
? null
: List.generate(
(topArtists as List).length,
(i) => Artist.fromJson(topArtists[i]),
);
}