github_trend 1.1.8

  • Readme
  • Changelog
  • Example
  • Installing
  • 56

Github trending api for dart #

Get the popular repository on github. You can also get popular repository by language or time(daily, weekly, monthly).

Install #

install from pub dev

Usage #

A simple usage example:

import 'package:github_trend/github_trend.dart';
import 'package:html/dom.dart';

main() async {
  GithubTrend githubTrend = GithubTrend();
  try {
    Document document = await githubTrend.fetchTrending();
    List<Repo> repos = Repos(document).list;
    List<String> languages = Languages(document).list;
    repos[0].name;
    print(languages);
  } catch (e) {
    // handle error
  }
}

Doc #

Online Doc

Local Doc

git clone git@github.com:huangyanxiong01/github_trending.git
pub get
dartdoc
pub global activate dhttpd
dhttpd --path doc/api

Server started on port 8080

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1.1.8 #

  • Refactoring
  • Incompatible past version API

0.1.8 #

  • Change the way the star element is obtained, and make the library more adaptable to the layout of the github trend
  • Update the way the language is interpreted

0.1.7 #

  • Adapt to the new github trending layout

0.1.6 #

  • Add url return in fetchRepos function

0.1.5 #

  • Add fetch languages method to docs

0.1.4 #

  • Rename open api
  • Fix URI duplicate link error

0.1.3 #

  • Fix duplicate requests when getting a language

0.1.2 #

  • Fix error package name in doc

0.1.1 #

  • Rename class method
  • Add fetch languages method to class and example,test
  • Rename package name

0.1.0 #

  • Initial version, created by Stagehand

example/README.md

import 'package:github_trend/github_trending.dart';

main() async {
  GithubTrend githubTrend = GithubTrend();
  // fetch languages
  List<String> languages = await githubTrend.fetchLanguages();
  print(languages);
  
  // default time language
  try {
    List<Map<String, dynamic>> defaultArray =
        await githubTrend.getTrendingRepos();
    print(defaultArray);
  } catch (e) {
    // get origin response
    githubTrend.response;
    print(e);
  }

  // rust language and default time
  List<Map<String, dynamic>> rustArray =
      await githubTrend.getTrendingRepos(language: 'rust');
  print(rustArray);

  // rust language and last weekly
  List<Map<String, dynamic>> rustWeekArray =
      await githubTrend.getTrendingRepos(language: 'rust', since: 'weekly');
  print(rustWeekArray);

  // return default trending when pass error since and language params.
  List<Map<String, dynamic>> rustWeekArrayerror =
      await githubTrend.getTrendingRepos(language: 'error', since: 'error');
  print(rustWeekArrayerror);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  github_trend: ^1.1.8

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:github_trend/github_trend.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
13
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
56
Learn more about scoring.

We analyzed this package on Oct 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:github_trend/github_trend.dart.

Health suggestions

Format lib/src/config.dart.

Run dartfmt to format lib/src/config.dart.

Format lib/src/languages.dart.

Run dartfmt to format lib/src/languages.dart.

Format lib/src/repo.dart.

Run dartfmt to format lib/src/repo.dart.

Format lib/src/repos.dart.

Run dartfmt to format lib/src/repos.dart.

Format lib/src/trending.dart.

Run dartfmt to format lib/src/trending.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
html ^0.14.0+1 0.14.0+3
http ^0.12.0+2 0.12.0+2
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
csslib 0.16.1
http_parser 3.1.3
meta 1.1.7
path 1.6.4
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
pedantic ^1.0.0 1.8.0+1
test ^1.0.0