news_api_flutter_package 1.2.0 copy "news_api_flutter_package: ^1.2.0" to clipboard
news_api_flutter_package: ^1.2.0 copied to clipboard

Flutter package for accessing News API. (https://newsapi.org/)

News API Flutter Package #

Flutter package for accessing News API. (https://newsapi.org/)

Getting Started #

Initialization #

NewsAPI _newsAPI = NewsAPI("your_api_key");

Get API key from here

Top Headlines #

Future<List<Article>> articleList = _newsAPI.getTopHeadlines();

Parameters
String country, String category, String sources, String query, int pageSize, int page

Details on request and parameters

Everything #

Future<List<Article>> articleList = _newsAPI.getEverything();

Parameters
String query, String queryInTitle, String sources, String domains, String excludeDomains, DateTime from, DateTime to, String language, String sortBy, int pageSize, int page

Details on request and parameters

Sources #

Future<List<Source>> sources = _newsAPI.getSources();

Parameters
String category, String language, String country

Details on request and parameters

Errors #

Any error occurred will be instance of ApiError.

class ApiError {
  String code;
  String message;
}

Details on errors


I'm always working on making improvements. If you have any feedback, issues, or suggestions, feel free to reach out. Happy coding!

9
likes
150
pub points
76%
popularity

Publisher

verified publishersharmadhiraj.com

Flutter package for accessing News API. (https://newsapi.org/)

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, http

More

Packages that depend on news_api_flutter_package