Update to latest json_serializable and source_gen
MODIFY
lib/src/common.dart
lib/src/common.dart
@@ -9,7 +9,7 @@ import "package:html/dom.dart" as html;
import "package:html/parser.dart" as html_parser;
import "package:http/http.dart" as http;
import "package:quiver/async.dart" show FutureGroup;
-import "package:source_gen/generators/json_serializable.dart";
+import "package:json_serializable/annotations.dart";
import "package:xml/xml.dart" as xml;
import 'util.dart';

MODIFY
lib/src/common.g.dart
lib/src/common.g.dart
@@ -4,23 +4,20 @@ part of github.common;
// **************************************************************************
// Generator: JsonSerializableGenerator
-// Target: class GitTree
// **************************************************************************
-GitTree _$GitTreeFromJson(Map json) => new GitTree(
+GitTree _$GitTreeFromJson(Map<String, dynamic> json) => new GitTree(
json['sha'] as String,
json['url'] as String,
json['truncated'] as bool,
(json['tree'] as List)
- ?.map((v0) => v0 == null ? null : new GitTreeEntry.fromJson(v0))
+ ?.map((e) => e == null
+ ? null
+ : new GitTreeEntry.fromJson(e as Map<String, dynamic>))
?.toList());
-// **************************************************************************
-// Generator: JsonSerializableGenerator
-// Target: class GitTreeEntry
-// **************************************************************************
-
-GitTreeEntry _$GitTreeEntryFromJson(Map json) => new GitTreeEntry(
+GitTreeEntry _$GitTreeEntryFromJson(Map<String, dynamic> json) =>
+ new GitTreeEntry(
json['path'] as String,
json['mode'] as String,
json['type'] as String,
@@ -28,80 +25,53 @@ GitTreeEntry _$GitTreeEntryFromJson(Map json) => new GitTreeEntry(
json['sha'] as String,
json['url'] as String);
-// **************************************************************************
-// Generator: JsonSerializableGenerator
-// Target: class GitHubComparison
-// **************************************************************************
-
-GitHubComparison _$GitHubComparisonFromJson(Map json) => new GitHubComparison(
+GitHubComparison _$GitHubComparisonFromJson(Map<String, dynamic> json) =>
+ new GitHubComparison(
json['url'] as String,
json['status'] as String,
json['ahead_by'] as int,
json['behind_by'] as int,
json['total_commits'] as int);
-// **************************************************************************
-// Generator: JsonSerializableGenerator
-// Target: class Tag
-// **************************************************************************
-
-Tag _$TagFromJson(Map json) => new Tag(
+Tag _$TagFromJson(Map<String, dynamic> json) => new Tag(
json['name'] as String,
- json['commit'] == null ? null : new CommitInfo.fromJson(json['commit']),
+ json['commit'] == null
+ ? null
+ : new CommitInfo.fromJson(json['commit'] as Map<String, dynamic>),
json['zipball_url'] as String,
json['tarball_url'] as String);
-// **************************************************************************
-// Generator: JsonSerializableGenerator
-// Target: class CommitData
-// **************************************************************************
-
-CommitData _$CommitDataFromJson(Map json) => new CommitData(
+CommitData _$CommitDataFromJson(Map<String, dynamic> json) => new CommitData(
json['sha'] as String,
json['commit'] == null ? null : new GitCommit.fromJson(json['commit']),
json['url'] as String,
json['html_url'] as String,
json['comments_url'] as String,
- json['author'] == null ? null : new CommitDataUser.fromJson(json['author']),
+ json['author'] == null
+ ? null
+ : new CommitDataUser.fromJson(json['author'] as Map<String, dynamic>),
json['committer'] == null
? null
- : new CommitDataUser.fromJson(json['committer']),
- (json['parents'] as List)
- ?.map((v0) => v0 as Map<String, dynamic>)
- ?.toList());
+ : new CommitDataUser.fromJson(
+ json['committer'] as Map<String, dynamic>),
+ (json['parents'] as List)?.map((e) => e as Map<String, dynamic>)?.toList());
-// **************************************************************************
-// Generator: JsonSerializableGenerator
-// Target: class CommitDataUser
-// **************************************************************************
-
-CommitDataUser _$CommitDataUserFromJson(Map json) => new CommitDataUser(
+CommitDataUser _$CommitDataUserFromJson(Map<String, dynamic> json) =>
+ new CommitDataUser(
json['login'] as String, json['id'] as int, json['type'] as String);
-// **************************************************************************
-// Generator: JsonSerializableGenerator
-// Target: class CommitInfo
-// **************************************************************************
-
-CommitInfo _$CommitInfoFromJson(Map json) => new CommitInfo(
+CommitInfo _$CommitInfoFromJson(Map<String, dynamic> json) => new CommitInfo(
json['sha'] as String,
- json['tree'] == null ? null : new GitTree.fromJson(json['tree']));
-
-// **************************************************************************
-// Generator: JsonSerializableGenerator
-// Target: class UserInformation
-// **************************************************************************
+ json['tree'] == null
+ ? null
+ : new GitTree.fromJson(json['tree'] as Map<String, dynamic>));
-UserInformation _$UserInformationFromJson(Map json) => new UserInformation(
- json['login'] as String,
- json['id'] as int,
- json['avatar_url'] as String,
- json['html_url'] as String);
+UserInformation _$UserInformationFromJson(Map<String, dynamic> json) =>
+ new UserInformation(json['login'] as String, json['id'] as int,
+ json['avatar_url'] as String, json['html_url'] as String);
-// **************************************************************************
-// Generator: JsonSerializableGenerator
-// Target: class Branch
-// **************************************************************************
-
-Branch _$BranchFromJson(Map json) => new Branch(json['name'] as String,
- json['commit'] == null ? null : new CommitData.fromJson(json['commit']));
+Branch _$BranchFromJson(Map<String, dynamic> json) => new Branch(
+ json['name'] as String,
+ json['commit'] == null
+ ? null
+ : new CommitData.fromJson(json['commit'] as Map<String, dynamic>));

MODIFY
lib/src/common/model/git.dart
lib/src/common/model/git.dart
@@ -164,7 +164,7 @@ class GitTree {
/// GitHub's maximum limit.
final bool truncated;
- @JsonKey("tree")
+ @JsonKey(name: "tree")
final List<GitTreeEntry> entries;
GitTree(this.sha, this.url, this.truncated, this.entries);

MODIFY
lib/src/common/model/repos.dart
lib/src/common/model/repos.dart
@@ -6,13 +6,13 @@ class GitHubComparison {
final String status;
- @JsonKey('ahead_by')
+ @JsonKey(name: 'ahead_by')
final int aheadBy;
- @JsonKey('behind_by')
+ @JsonKey(name: 'behind_by')
final int behindBy;
- @JsonKey('total_commits')
+ @JsonKey(name: 'total_commits')
final int totalCommits;
GitHubComparison(
@@ -206,9 +206,9 @@ class Tag {
final String name;
final CommitInfo commit;
- @JsonKey('zipball_url')
+ @JsonKey(name: 'zipball_url')
final String zipUrl;
- @JsonKey('tarball_url')
+ @JsonKey(name: 'tarball_url')
final String tarUrl;
Tag(this.name, this.commit, this.zipUrl, this.tarUrl);
@@ -225,13 +225,13 @@ class CommitData {
final String sha;
final GitCommit commit;
- @JsonKey("url")
+ @JsonKey(name: "url")
final String url;
- @JsonKey("html_url")
+ @JsonKey(name: "html_url")
final String htmlUrl;
- @JsonKey("comments_url")
+ @JsonKey(name: "comments_url")
final String commentsUrl;
final CommitDataUser author, committer;
@@ -277,11 +277,11 @@ class UserInformation {
final int id;
/// Avatar Url
- @JsonKey("avatar_url")
+ @JsonKey(name: "avatar_url")
final String avatarUrl;
/// Url to the user's GitHub Profile
- @JsonKey("html_url")
+ @JsonKey(name: "html_url")
final String htmlUrl;
UserInformation(this.login, this.id, this.avatarUrl, this.htmlUrl);

MODIFY
pubspec.yaml
pubspec.yaml
@@ -8,12 +8,13 @@ environment:
dependencies:
html: '>=0.12.0 <0.14.0'
http: '^0.11.3'
+ json_serializable: '^0.2.1'
markdown: '^0.11.1'
quiver: '>=0.20.0 <0.25.0'
- source_gen: '^0.6.1'
xml: '^2.0.0'
dev_dependencies:
browser: '^0.10.0+2'
build_runner: ^0.3.0
+ source_gen: '^0.7.0'
test: '^0.12.0'
mockito: '^1.0.1'

MODIFY
tool/phases.dart
tool/phases.dart
import 'package:build_runner/build_runner.dart';
+import 'package:json_serializable/generators.dart';
import 'package:source_gen/source_gen.dart';
-import 'package:source_gen/generators/json_serializable_generator.dart';
final PhaseGroup phases = new PhaseGroup.singleAction(
- new GeneratorBuilder(const [
+ new PartBuilder(const [
const JsonSerializableGenerator(),
]),
new InputSet('github', const ['lib/src/common.dart']));

Update to latest json_serializable and source_gen