diff --git a/build.yaml b/build.yaml index f122e36..cf8a18e 100644 --- a/build.yaml +++ b/build.yaml @@ -16,7 +16,7 @@ targets: # create_to_json: true # disallow_unrecognized_keys: false # explicit_to_json: false - field_rename: snake + # field_rename: snake # generate_to_json_function: true # include_if_null: true # nullable: true diff --git a/lib/main.dart b/lib/main.dart index b50f81e..e5e8f93 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -7,7 +7,6 @@ import 'screens/notifications.dart'; import 'screens/search.dart'; import 'screens/me.dart'; import 'screens/login.dart'; -import 'screens/pull_request.dart'; import 'screens/issue.dart'; import 'screens/repos.dart'; diff --git a/lib/models/account.dart b/lib/models/account.dart new file mode 100644 index 0000000..7b5012a --- /dev/null +++ b/lib/models/account.dart @@ -0,0 +1,22 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; + +part 'account.g.dart'; + +@JsonSerializable() +class AccountModel { + String avatarUrl; + String token; + String domain; + + AccountModel({ + @required this.avatarUrl, + @required this.token, + this.domain, + }); + + factory AccountModel.fromJson(Map json) => + _$AccountModelFromJson(json); + + Map toJson() => _$AccountModelToJson(this); +} diff --git a/lib/models/account.g.dart b/lib/models/account.g.dart new file mode 100644 index 0000000..a34e5ae --- /dev/null +++ b/lib/models/account.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'account.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AccountModel _$AccountModelFromJson(Map json) { + return AccountModel( + avatarUrl: json['avatarUrl'] as String, + token: json['token'] as String, + domain: json['domain'] as String); +} + +Map _$AccountModelToJson(AccountModel instance) => + { + 'avatarUrl': instance.avatarUrl, + 'token': instance.token, + 'domain': instance.domain + }; diff --git a/lib/models/user.g.dart b/lib/models/user.g.dart index e4a411c..c78687f 100644 --- a/lib/models/user.g.dart +++ b/lib/models/user.g.dart @@ -9,18 +9,18 @@ part of 'user.dart'; User _$UserFromJson(Map json) { return User( json['login'] as String, - json['avatar_url'] as String, + json['avatarUrl'] as String, json['name'] as String, - json['public_repos'] as int, + json['publicRepos'] as int, json['followers'] as int, json['following'] as int); } Map _$UserToJson(User instance) => { 'login': instance.login, - 'avatar_url': instance.avatarUrl, + 'avatarUrl': instance.avatarUrl, 'name': instance.name, - 'public_repos': instance.publicRepos, + 'publicRepos': instance.publicRepos, 'followers': instance.followers, 'following': instance.following };