File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 1+ import 'package:args/args.dart' ;
2+ import 'package:dio/dio.dart' ;
13import 'dart:convert' ;
24import 'dart:io' ;
35
@@ -23,11 +25,23 @@ class GthUser {
2325
2426 GthUser (String username) : this ._url = BASE_URL + username;
2527
26- void init () async {}
28+ Future <void > init () async {
29+ var obj = await Dio ().get (this ._url).data;
30+
31+ this .name = obj["name" ];
32+ this .bio = obj["bio" ];
33+ this .link = obj["html_url" ];
34+
35+ this .repos = GthUserItem (obj["public_repos" ]);
36+ this .gists = GthUserItem (obj["public_gists" ]);
37+ this .followers = GthUserItem (obj["followers" ]);
38+ this .following = GthUserItem (obj["following" ]);
39+ }
40+
41+ Future <void > fetch (String thing) async {}
2742}
2843
2944void main (List <String > args) async {
3045 var user = GthUser (args[0 ]);
31- user.init ();
32- print (user._url);
46+ await user.init ();
3347}
You can’t perform that action at this time.
0 commit comments