flutter_news_service 1.0.4 copy "flutter_news_service: ^1.0.4" to clipboard
flutter_news_service: ^1.0.4 copied to clipboard

A Dart package designed for accessing worldwide news data from NewsAPI.org. It can filter news by keyword, source, language and more. Ideal for news-based applications.

example/flutter_news_service_example.dart

import 'package:flutter_news_service/flutter_news_service.dart';

Future<void> main() async {
  var newsService = FlutterNewsService('<your-api-key>');

  var topHeadlines = await newsService.fetchTopHeadlines(country: 'us');
  print('Top Headlines: ${topHeadlines.articles.map((a) => a.title).toList()}');

  var everything = await newsService.fetchEverything(
      q: 'bitcoin', from: '2023-05-15', sortBy: 'publishedAt');
  print('Everything: ${everything.articles.map((a) => a.title).toList()}');

  var sources = await newsService.fetchSources(language: 'en', country: 'us');
  print('Sources: ${sources.map((s) => s.name).toList()}');
}
3
likes
160
pub points
41%
popularity

Publisher

verified publisherhumg.edu.vn

A Dart package designed for accessing worldwide news data from NewsAPI.org. It can filter news by keyword, source, language and more. Ideal for news-based applications.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

http

More

Packages that depend on flutter_news_service