fetchSongDetails method

Future<Song> fetchSongDetails({
  1. required String songId,
})

Implementation

Future<Song> fetchSongDetails({required String songId}) async {
  try {
    String songUrl = songDetailURL + songId;
    var map = await cache.remember(
      'songDetails_$songId',
      () async => Map<String, dynamic>.from(json.decode(await http
          .get(Uri.parse(songUrl), headers: {
        "Accept": "application/json"
      }).then((value) => value.body.split("-->")[1]))[songId]),
      86400,
    );
    return await PluginFactory.createSong(map);
  } catch (e) {
    throw e;
  }
}