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

A dart client for the Hacker News API, with API response types. For use with Flutter Hacker News Clients.

example/example.dart

import 'package:hn_api/client.dart' as hn;
import 'package:hn_api/responses.dart' as responses;

void main() async {
  hn.HackerNewsClient client = hn.HackerNewsClient();

  // Get a specific [Story]
  responses.Story story = await client.getStory(8863);

  // Get an [Item] that could be [Story], [Ask], [Job], or [Poll]
  responses.Item item = await client.getItem(8863);

  // Get the top 5 stories (storyCount defaults to 10)
  List<responses.Item> topStories = await client.getTopStories(storyCount: 5);
}
0
likes
70
pub points
0%
popularity

Publisher

unverified uploader

A dart client for the Hacker News API, with API response types. For use with Flutter Hacker News Clients.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

console, freezed, freezed_annotation, http, json_annotation

More

Packages that depend on hn_api