Skip to content

Make method createGitHubClient support vm flutter and web. #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 21, 2019

Conversation

CaiJingLong
Copy link
Contributor

Imitate the way http is written, let the createGitHubClient method work on dart vm, flutter and web.

@CaiJingLong
Copy link
Contributor Author

CaiJingLong commented Oct 18, 2019

This way of import comes from the http library.

Now whether it is vm or web or flutter, we can use the same code to create github client.
Just like this:

import 'package:github/github.dart';

void main(){
  final auth = Authentication.basic("", "");

  final github = createGitHubClient(
    auth: auth,
  );

  final user = await github.users.getCurrentUser();
  print(user.toJson());

  github.dispose();
}

@robrbecker
Copy link
Member

Interesting! I'll take a look. Thanks!

@robrbecker
Copy link
Member

After reviewing, I think this will work in the short term. I'll get this merged and come back to further clean up the split between dart:html and dart:io. If using > 0.12.0 of the http package, it gets a lot easier.

@robrbecker robrbecker merged commit 0201c53 into SpinlockLabs:master Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants