fetchTopSongs method

Future<Playlist> fetchTopSongs({
  1. int? expiredAt = 86400,
  2. int? n = 30,
})

Implementation

Future<Playlist> fetchTopSongs({int? expiredAt = 86400, int? n = 30}) async {
  try {
    var response =
        await http.get(Uri.parse(topSongsURL.replaceFirst('&n=30', '&n=$n')));
    var map = Map<String, dynamic>.from(jsonDecode(response.body));
    return await PluginFactory.createPlayList(map);
  } catch (e) {
    throw e;
  }
}