flutter_github_api 0.2.1+2

  • Readme
  • Changelog
  • Example
  • Installing
  • new75

flutter github api #

Pub

flutter github v3 api library based on github.dart

api extension #

  • get authorization
  • third part login
  • get token

getting start #

dependencies:
  github: ^0.2.0

usage #

  1. third part login
    import 'package:flutter_github_api/flutter_github_api.dart';
    import 'flutter_github_api/entity/index.dart';
    User user;

    login(String username,String password){
    	// how to get clientId and clientSecret please visit https://github.com/settings/apps/new
        Auth auth = Auth('your clientId', 'your clientSecret');
        GithubOauth oauth = GithubOauth(auth);
        oauth.login(username,password).then((result){
        	if(result.data == null){
        		// 1. this means your clientId or clientSecret is error
        		// 2. this means your username or password is error
        		// 3. detail information please see result.code and result.message
        	} else {
        		setState((){
        		  this.user = result.data;
        		});
        	}
        });
    }
  1. get token
  import 'package:flutter_github_api/flutter_github_api.dart';
  import 'flutter_github_api/entity/index.dart';
  
    String token='';
    getToken(String username,String password){
	    GithubOauth oauth = GithubOauth(auth);
	    oauth.login(username,password).then((result){
            if(result.data == null){
                // 1. this means your clientId or clientSecret is error
                // 2. this means your username or password is error
                // 3. detail information please see result.code and result.message
            } else {
                setState((){
                  this.token = result.data;
                });
            }
        });
    }
  1. new issue
    import 'package:flutter_github_api/flutter_github_api.dart';
    import 'flutter_github_api/entity/index.dart';
    void main() {
    	// how to get the token please see No2
      GitHub github = createGitHubClient(auth:  Authentication.withToken(token));
      RepositorySlug slug = RepositorySlug("flutter_jp", "flutter_github_api");
      GithubIssueRequest issue = GithubIssueRequest('just a test');
      github.issues.create(slug, issue);
    }

image #

detail #

please visit github.dart

license #

MIT

[0.0.1] - 2019/09/25

  • just for test

[0.0.5] - 2019/09/25

  • add MIT license

[0.1.0] - 2019/09/27

  • improve heath point

[0.2.1+2] - 2019/10/15

  • add login api
  • add getToken api

example/README.md

example #

A Third Part Github Login Flutter application Example.

Getting Started #

detail information please see example/lib/main.dart

  User user;
  String username;
  String password;
  userLogin() {
    if (username.isEmpty || password.isEmpty) {
      return;
    }
    oauth.login(username, password).then((OauthResult<User> result) {
      if (result.data != null) {
        setState(() {
          this.user = result.data;
        });
      } else {
        print(result.code.toString() + ':' + result.message.toString() ?? '');
      }
    });
  }

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_github_api: ^0.2.1+2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support 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:flutter_github_api/flutter_github_api.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
50
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]
75
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
dio ^3.0.3 3.0.3
flutter 0.0.0
github ^5.4.0 5.4.0
json_annotation ^3.0.0 3.0.0
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.11 1.14.12
http 0.12.0+2
http_parser 3.1.3
meta 1.1.7
path 1.6.4
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
build_runner ^1.7.1
flutter_test
json_serializable ^3.2.2
pedantic any 1.8.0+1