NewsAPI class

A class for interacting with the News API.

Constructors

NewsAPI({required String apiKey})
Creates a NewsAPI instance with the given apiKey.

Properties

apiKey String
The API key used for authentication.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getEverything({String? query, String? queryInTitle, String? sources, String? domains, String? excludeDomains, DateTime? from, DateTime? to, String? language, String? sortBy, int? pageSize, int? page}) Future<List<Article>>
Fetches a list of articles based on the provided query parameters.
getSources({String? category, String? language, String? country}) Future<List<Source>>
Fetches a list of news sources from the API.
getTopHeadlines({String? country, String? category, String? sources, String? query, int? pageSize, int? page}) Future<List<Article>>
Fetches a list of top headlines based on the provided query parameters.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited