newsapi 1.0.1 copy "newsapi: ^1.0.1" to clipboard
newsapi: ^1.0.1 copied to clipboard

outdated

Use the NewsApi v2 service in Dart. The library has a clear return structure and an easy-to-use API.

example/main.dart

import 'package:newsapi/newsapi.dart';

main() async {
  var newsApi = NewsApi();
  newsApi.init(
//    dioOptions: dioOptions,
//    interceptors: interceptors,
    debugLog: true,
    apiKey: 'foo',
  );

  newsApi.apiKey = 'Change_your_api_key';

  print(await newsApi.topHeadlines(
//    country: country,
//    category: category,
//    sources: sources,
//    q: q,
    language: 'en',
//    pageSize: pageSize,
//    page: page,
  ));
  print(await newsApi.everything(
    q: 'flutter',
//    qInTitle: qInTitle,
//    sources: sources,
//    domains: domains,
//    excludeDomains: excludeDomains,
//    from: from, // support DateTime or String
//    to: to, // support DateTime or String
//    language: language,
//    sortBy: sortBy,
//    pageSize: pageSize,
//    page: page,
  ));
  print(await newsApi.sources(
//    category: category,
//    language: language,
//    country: country,
      ));
}
10
likes
0
points
30
downloads

Publisher

verified publisheryeungkc.com

Weekly Downloads

Use the NewsApi v2 service in Dart. The library has a clear return structure and an easy-to-use API.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dio, equatable, json_annotation, pretty_dio_logger, retrofit

More

Packages that depend on newsapi