getSources method
Fetches a list of news sources from the API.
Optional parameters:
category
: The category of news sources to retrieve.language
: The language of news sources to retrieve.country
: The country of news sources to retrieve.
Implementation
Future<List<Source>> getSources({
String? category,
String? language,
String? country,
}) async {
final String url = Util.buildSourcesUrl(
"sources",
category,
language,
country,
);
final dynamic response = await Util.call(
apiKey: apiKey,
url: url,
dataKey: "sources",
);
return Source.parseList(response);
}