search method

Future<ArtistSearchResults> search({
  1. required String artist,
  2. int page = 1,
  3. int limit = 30,
})

Search for an artist by name. Returns artist matches sorted by relevance.

https://www.last.fm/api/show/artist.search.

Implementation

Future<ArtistSearchResults> search({
  required String artist,
  int page = 1,
  int limit = 30,
}) async {
  final parameters = {'artist': artist, 'page': page, 'limit': limit};

  final request = Request(
    api: _api,
    method: 'artist.search',
    parameters: parameters,
  );

  final response = await request.send(mode: RequestMode.GET);

  return ArtistSearchResults.fromJson(response['results']);
}