buildTopHeadlinesUrl static method
Implementation
static String buildTopHeadlinesUrl(
String? country,
String? category,
String? sources,
String? query,
int? pageSize,
int? page,
) {
final Uri url = Uri.parse("top-headlines?x=y");
final queryParams = <String, String>{};
if (country != null) queryParams["country"] = country;
if (category != null) queryParams["category"] = category;
if (sources != null) queryParams["sources"] = sources;
if (query != null) queryParams["q"] = query;
if (pageSize != null) queryParams["pageSize"] = pageSize.toString();
if (page != null) queryParams["page"] = page.toString();
return url.replace(queryParameters: queryParams).toString();
}