searchSongs method

Future<List<SongDetailed>> searchSongs(
  1. String query
)

Performs a search specifically for songs with the given query and returns a list of song details.

Implementation

Future<List<SongDetailed>> searchSongs(String query) async {
  final searchData = await constructRequest(
    "search",
    body: {
      "query": query,
      "params": "Eg-KAQwIARAAGAAgACgAMABqChAEEAMQCRAFEAo%3D"
    },
  );

  final results =
      traverseList(searchData, ["musicResponsiveListItemRenderer"]);
  final mappedResults = results.map(SongParser.parseSearchResult).toList();

  return mappedResults;
}