Socialify

Folder ..

Viewing profile.dart
17 lines (14 loc) • 345.0 B

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
import 'package:github/github.dart';

class GithubProfile {
  GithubProfile(this.token);

  final String token;

  Future<User> getProfile() async {
    final github = GitHub(auth: Authentication.withToken(token));
    try {
      final user = await github.users.getCurrentUser();
      return user;
    } catch (e) {
      rethrow;
    }
  }
}