search method

Future<List<SearchResult>> search(
  1. String query
)

Performs a search for music with the given query and returns a list of search results.

Implementation

Future<List<SearchResult>> search(String query) async {
  final searchData = await constructRequest(
    "search",
    body: {"query": query, "params": null},
  );

  return traverseList(searchData, ["musicResponsiveListItemRenderer"])
      .map(SearchParser.parse)
      .where((e) => e != null)
      .cast<SearchResult>()
      .toList();
}