getCorrection method
Use the last.fm corrections data to check whether the supplied artist has a correction to a canonical artist.
Implementation
Future<List<Track>> getCorrection({
required String track,
required String artist,
}) async {
final parameters = {'track': track, 'artist': artist};
final request = Request(
api: _api,
method: 'track.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) =>
Track.fromJson(response['corrections']['correction']['track'][i]),
);
}
// A list of a single correction.
return [Track.fromJson(corrections['correction']['track'])];
}