getAlbum method
Retrieves detailed information about an album given its album ID.
Implementation
Future<AlbumFull> getAlbum(String albumId) async {
final data = await constructRequest("browse", body: {"browseId": albumId});
final album = AlbumParser.parse(data, albumId);
final artistSongs = await getArtistSongs(album.artist.artistId ?? '');
final filteredSongs = artistSongs.where(
(song) => album.songs
.where((item) =>
'${song.album?.name}-${song.name}' ==
'${item.album?.name}-${item.name}')
.isNotEmpty,
);
final songsThatArentInArtist = album.songs.where(
(item) => artistSongs
.where((song) =>
'${song.album?.name}-${song.name}' ==
'${item.album?.name}-${item.name}')
.isEmpty,
);
return album..songs = [...filteredSongs, ...songsThatArentInArtist];
}