Latest source gen, and other fixes
MODIFY
analysis_options.yaml
analysis_options.yaml
-analyzer:
- strong-mode: true
-
linter:
rules:
- always_declare_return_types

MODIFY
lib/src/common.g.dart
lib/src/common.g.dart
@@ -118,36 +118,22 @@ LicenseDetails _$LicenseDetailsFromJson(Map<String, dynamic> json) {
: new LicenseKind.fromJson(json['license'] as Map<String, dynamic>));
}
-abstract class _$LicenseDetailsSerializerMixin {
- String get name;
- String get path;
- String get sha;
- int get size;
- Uri get url;
- Uri get htmlUrl;
- Uri get gitUrl;
- Uri get downloadUrl;
- String get type;
- String get content;
- String get encoding;
- Links get links;
- LicenseKind get license;
- Map<String, dynamic> toJson() => <String, dynamic>{
- 'name': name,
- 'path': path,
- 'sha': sha,
- 'size': size,
- 'url': url?.toString(),
- 'html_url': htmlUrl?.toString(),
- 'git_url': gitUrl?.toString(),
- 'download_url': downloadUrl?.toString(),
- 'type': type,
- 'content': content,
- 'encoding': encoding,
- '_links': links,
- 'license': license
+Map<String, dynamic> _$LicenseDetailsToJson(LicenseDetails instance) =>
+ <String, dynamic>{
+ 'name': instance.name,
+ 'path': instance.path,
+ 'sha': instance.sha,
+ 'size': instance.size,
+ 'url': instance.url?.toString(),
+ 'html_url': instance.htmlUrl?.toString(),
+ 'git_url': instance.gitUrl?.toString(),
+ 'download_url': instance.downloadUrl?.toString(),
+ 'type': instance.type,
+ 'content': instance.content,
+ 'encoding': instance.encoding,
+ '_links': instance.links,
+ 'license': instance.license
};
-}
LicenseKind _$LicenseKindFromJson(Map<String, dynamic> json) {
return new LicenseKind(
@@ -158,20 +144,14 @@ LicenseKind _$LicenseKindFromJson(Map<String, dynamic> json) {
nodeId: json['node_id'] as String);
}
-abstract class _$LicenseKindSerializerMixin {
- String get key;
- String get name;
- String get spdxId;
- Uri get url;
- String get nodeId;
- Map<String, dynamic> toJson() => <String, dynamic>{
- 'key': key,
- 'name': name,
- 'spdx_id': spdxId,
- 'url': url?.toString(),
- 'node_id': nodeId
+Map<String, dynamic> _$LicenseKindToJson(LicenseKind instance) =>
+ <String, dynamic>{
+ 'key': instance.key,
+ 'name': instance.name,
+ 'spdx_id': instance.spdxId,
+ 'url': instance.url?.toString(),
+ 'node_id': instance.nodeId
};
-}
Links _$LinksFromJson(Map<String, dynamic> json) {
return new Links(
@@ -180,13 +160,8 @@ Links _$LinksFromJson(Map<String, dynamic> json) {
html: json['html'] == null ? null : Uri.parse(json['html'] as String));
}
-abstract class _$LinksSerializerMixin {
- Uri get self;
- Uri get git;
- Uri get html;
- Map<String, dynamic> toJson() => <String, dynamic>{
- 'self': self?.toString(),
- 'git': git?.toString(),
- 'html': html?.toString()
+Map<String, dynamic> _$LinksToJson(Links instance) => <String, dynamic>{
+ 'self': instance.self?.toString(),
+ 'git': instance.git?.toString(),
+ 'html': instance.html?.toString()
};
-}

MODIFY
lib/src/common/git_service.dart
lib/src/common/git_service.dart
@@ -95,8 +95,8 @@ class GitService extends Service {
.request('PATCH', '/repos/${slug.fullName}/git/refs/$ref',
body: body, headers: headers)
.then((response) {
- return GitReference
- .fromJSON(jsonDecode(response.body) as Map<String, dynamic>);
+ return GitReference.fromJSON(
+ jsonDecode(response.body) as Map<String, dynamic>);
});
}

MODIFY
lib/src/common/model/authorizations.dart
lib/src/common/model/authorizations.dart
@@ -22,8 +22,8 @@ class Authorization {
..id = input['id']
..scopes = input['scopes'] as List<String>
..token = input['token']
- ..app = AuthorizationApplication
- .fromJSON(input['app'] as Map<String, dynamic>)
+ ..app = AuthorizationApplication.fromJSON(
+ input['app'] as Map<String, dynamic>)
..note = input['note']
..noteUrl = input['note_url']
..createdAt = parseDateTime(input['created_at'])

MODIFY
lib/src/common/model/issues.dart
lib/src/common/model/issues.dart
@@ -77,8 +77,8 @@ class Issue {
..milestone =
Milestone.fromJSON(input['milestone'] as Map<String, dynamic>)
..commentsCount = input['comments']
- ..pullRequest = IssuePullRequest
- .fromJSON(input['pull_request'] as Map<String, dynamic>)
+ ..pullRequest = IssuePullRequest.fromJSON(
+ input['pull_request'] as Map<String, dynamic>)
..createdAt = parseDateTime(input['created_at'])
..updatedAt = parseDateTime(input['updated_at'])
..closedAt = parseDateTime(input['closed_at'])

MODIFY
lib/src/common/model/orgs.dart
lib/src/common/model/orgs.dart
@@ -208,8 +208,8 @@ class TeamRepository extends Repository {
..pushedAt = parseDateTime(input['pushed_at'])
..owner = UserInformation.fromJSON(input['owner'] as Map<String, dynamic>)
..isPrivate = input['private']
- ..permissions = TeamRepositoryPermissions
- .fromJSON(input['permissions'] as Map<String, dynamic>);
+ ..permissions = TeamRepositoryPermissions.fromJSON(
+ input['permissions'] as Map<String, dynamic>);
}
}

MODIFY
lib/src/common/model/repos.dart
lib/src/common/model/repos.dart
@@ -455,7 +455,7 @@ class LanguageBreakdown {
}
@JsonSerializable()
-class LicenseDetails extends Object with _$LicenseDetailsSerializerMixin {
+class LicenseDetails {
final String name;
final String path;
final String sha;
@@ -495,10 +495,12 @@ class LicenseDetails extends Object with _$LicenseDetailsSerializerMixin {
factory LicenseDetails.fromJson(Map<String, dynamic> json) =>
_$LicenseDetailsFromJson(json);
+
+ Map<String, dynamic> toJson() => _$LicenseDetailsToJson(this);
}
@JsonSerializable()
-class LicenseKind extends Object with _$LicenseKindSerializerMixin {
+class LicenseKind {
final String key;
final String name;
@@ -513,4 +515,6 @@ class LicenseKind extends Object with _$LicenseKindSerializerMixin {
factory LicenseKind.fromJson(Map<String, dynamic> json) =>
_$LicenseKindFromJson(json);
+
+ Map<String, dynamic> toJson() => _$LicenseKindToJson(this);
}

MODIFY
lib/src/common/model/repos_contents.dart
lib/src/common/model/repos_contents.dart
@@ -70,7 +70,7 @@ class GitHubFile {
}
@JsonSerializable()
-class Links extends Object with _$LinksSerializerMixin {
+class Links {
final Uri self;
final Uri git;
final Uri html;
@@ -82,6 +82,8 @@ class Links extends Object with _$LinksSerializerMixin {
return _$LinksFromJson(input);
}
+
+ Map<String, dynamic> toJson() => _$LinksToJson(this);
}
/// Model class for a file or directory.

MODIFY
lib/src/common/pulls_service.dart
lib/src/common/pulls_service.dart
@@ -59,8 +59,8 @@ class PullRequestsService extends Service {
.request("POST", '/repos/${slug.fullName}/pulls/$number',
body: jsonEncode(map))
.then((response) {
- return PullRequest
- .fromJSON(jsonDecode(response.body) as Map<String, dynamic>);
+ return PullRequest.fromJSON(
+ jsonDecode(response.body) as Map<String, dynamic>);
});
}
@@ -104,8 +104,8 @@ class PullRequestsService extends Service {
.request("PUT", "/repos/${slug.fullName}/pulls/$number/merge",
body: jsonEncode(json))
.then((response) {
- return PullRequestMerge
- .fromJSON(jsonDecode(response.body) as Map<String, dynamic>);
+ return PullRequestMerge.fromJSON(
+ jsonDecode(response.body) as Map<String, dynamic>);
});
}

MODIFY
pubspec.yaml
pubspec.yaml
@@ -9,10 +9,10 @@ dependencies:
html: '>=0.12.0 <0.14.0'
http: '^0.11.3'
http_parser: ^3.1.1
- json_annotation: '^0.2.8'
+ json_annotation: '>=0.2.8 <2.0.0'
xml: '>=2.0.0 <4.0.0'
dev_dependencies:
build_runner: ^0.9.0
- json_serializable: ^0.5.7
+ json_serializable: ^1.0.0
test: '^0.12.0'
mockito: '^1.0.1'

Latest source gen, and other fixes (#111)