File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -41,15 +41,17 @@ import 'package:github/github.dart';
41
41
42
42
and then use it:
43
43
44
- ** Example**
44
+ ### Example
45
+
45
46
``` dart
46
47
import 'package:github/github.dart';
47
48
48
49
Future<void> main() async {
49
50
/* Create a GitHub Client, with anonymous authentication by default */
50
51
var github = GitHub();
51
52
52
- /* or Create a GitHub Client and have it try to find your token or credentials automatically
53
+ /*
54
+ or Create a GitHub Client and have it try to find your token or credentials automatically
53
55
In Flutter and in server environments this will search environment variables in this order
54
56
GITHUB_ADMIN_TOKEN
55
57
GITHUB_DART_TOKEN
@@ -65,14 +67,13 @@ Future<void> main() async {
65
67
var github = GitHub(auth: findAuthenticationFromEnvironment());
66
68
67
69
/* or Create a GitHub Client using an auth token */
68
- var github = GitHub(auth: new Authentication.withToken(" YourTokenHere" ));
70
+ var github = GitHub(auth: Authentication.withToken(' YourTokenHere' ));
69
71
70
72
/* or Create a GitHub Client using a username and password */
71
- var github = GitHub(auth: new Authentication.basic('username', 'password'));
73
+ var github = GitHub(auth: Authentication.basic('username', 'password'));
72
74
73
- Repository repo = await github.repositories.getRepository(new RepositorySlug(" user_or_org", " repo_name" ));
75
+ Repository repo = await github.repositories.getRepository(RepositorySlug(' user_or_org', ' repo_name' ));
74
76
/* Do Something with repo */
75
-
76
77
}
77
78
```
78
79
You can’t perform that action at this time.
0 commit comments