flutter_news_api 0.0.2 copy "flutter_news_api: ^0.0.2" to clipboard
flutter_news_api: ^0.0.2 copied to clipboard

Flutter unofficial news api, a Dart / Flutter library for easy use

example/main.dart

import 'package:flutter_news_api/models/article_model.dart';
import 'package:flutter_news_api/flutter_news_api.dart';

void main() async {
  FlutterNewsService newsService = FlutterNewsService();

  // Get Top Articles
  List<Article> articles = await newsService.getArticlesTopHeadlines(
    apiKey: "<API-KEY>",
    category: Category.business,
    countryCode: "us",
    query: "flutter",
    sortBy: SortBy.popularity,
  );

  // Get everything article by query
  List<Article> articleList = await newsService.getArticlesByQuery(
      apiKey: "<API-KEY>",
      query: "",
      from: DateTime.now(),
      to: DateTime.now(),
      sortBy: SortBy.popularity,
      languageCode: "en");
  // Get top articles by source id
  List<Article> articleList2 =
      await newsService.getArticlesTopHeadlinesBySources(
    apiKey: "<API-KEY>",
    category: Category.general,
    countryCode: "us",
    sources: "bbc-news",
  );
  // Get all new source
  List<Sources> sources = await newsService.getAllSources(
      apiKey: "<API-KEY>",
      category: Category.general,
      language: "en",
      countryCode: "us");
}
4
likes
40
pub points
0%
popularity

Publisher

verified publisherbeatiapp.com

Flutter unofficial news api, a Dart / Flutter library for easy use

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter, http, intl

More

Packages that depend on flutter_news_api