getSongsByGenre method
Get all the songs in the Apple Music library with the genre
.
Specify a coverArtSize
to fetch the current song with that coverArtSize
.
Implementation
Future<List<Song>> getSongsByGenre(
{required String genre, int coverArtSize = 500}) async {
final result = await playerChannel.invokeMethod<List<dynamic>>(
'getSongsByGenre',
<String, dynamic>{'genre': genre, 'size': coverArtSize});
final songs = <Song>[];
if (result != null) {
for (var i = 0; i < result.length; i++) {
songs.add(Song.fromJson(Map<String, dynamic>.from(result[i])));
}
}
return songs;
}