getCorrection method
Use the last.fm corrections data to check whether the supplied artist has a correction to a canonical artist
Implementation
Future<List<Artist>> getCorrection({required String artist}) async {
final parameters = {'artist': artist};
final request = Request(
api: _api,
method: 'artist.getCorrection',
parameters: parameters,
);
final response = await request.send(mode: RequestMode.GET);
final corrections = response['corrections'];
if (corrections is List) {
return List.generate(
corrections.length,
(i) =>
Artist.fromJson(response['corrections']['correction']['artist'][i]),
);
}
// A list of a single correction.
return [Artist.fromJson(corrections['correction']['artist'])];
}