TopHeadlines class

Top headlines

This endpoint provides live top and breaking headlines for a country, single source, or multiple sources. You can also use a query to search with keywords. You can also set a category as well as a language. Articles are sorted by the earliest date first. This endpoint is great for retrieving headlines for display on news tickers or similar.

All parameters passed to TopHeadlines are optional, but you need to include at least one of them.

Constructors

TopHeadlines({List<String> sources, String query, Categories category, String country, int pageSize: 20, int page })

Properties

category Categories
The category you want to get headlines for. Possible options are contained in the Categories enum. [...]
final
country → String
The 2-letter ISO 3166-1 code for the country you want to get headlines for. Possible options are contained in the Countries class or can be written as strings. [...]
final
page → int
Use this to page through the results if the total results found is greater than the page size.
final
pageSize → int
The number of results to return per page (request). 20 is the default, 100 is the maximum.
final
parameters → Map<String, dynamic>
read-only
query → String
Keywords or phrase to search for.
final
sources → List<String>
A list of identifiers for the news sources or blogs you want headlines from. Use the Sources endpoint to locate these programatically or look at https://newsapi.org/sources. [...]
final
url → String
read-only
client → Client
final, inherited
hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
request(String apiKey) → Future<Map<String, dynamic>>
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited