charts method
Fetches the list of top podcasts
Optionally takes a limit
and Country filter. Defaults to
limit of 20 and no specified country.
The charts is returned as a 'feed'. In order to be compatible with
SearchResult
we need to parse this feed and fetch the underlying
result for each item resulting in a HTTP call for each result. Given
the infrequent update of the chart feed it is recommended that clients
cache the results.
Implementation
Future<SearchResult> charts({
Country country = Country.none,
String language = '',
int limit = 20,
bool explicit = false,
String genre = '',
Map<String, dynamic> queryParams = const {},
}) async {
_country = country;
_language = language;
_limit = limit;
_explicit = explicit;
_genre = genre;
if (searchProvider is PodcastIndexProvider) {
return PodcastIndexSearch(
userAgent: userAgent,
timeout: timeout,
podcastIndexProvider: searchProvider as PodcastIndexProvider,
).charts(
country: _country,
language: _language,
limit: _limit,
explicit: _explicit,
genre: _genre,
queryParams: queryParams,
);
}
return ITunesSearch(
userAgent: userAgent,
timeout: timeout,
).charts(
country: _country,
limit: _limit,
explicit: _explicit,
genre: _genre,
);
}