Skip to content

Commit dbb4f3b

Browse files
committed
更新json序列化
1 parent 1f52647 commit dbb4f3b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+902
-1115
lines changed

RECORD.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class Strings{
2727
### Json序列化
2828

2929
生成序列化模板
30-
flutter packages pub run build_runner build
30+
flutter packages pub run build_runner build --delete-conflicting-outputs
31+
3132

3233
### 配合AutomaticKeepAliveClientMixin可以keep住tab
3334

lib/common/model/Branch.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:json_annotation/json_annotation.dart';
88
part 'Branch.g.dart';
99

1010
@JsonSerializable()
11-
class Branch extends Object with _$BranchSerializerMixin {
11+
class Branch {
1212
String name;
1313
String tarballUrl;
1414
@JsonKey(name: "zipball_url")
@@ -20,4 +20,6 @@ class Branch extends Object with _$BranchSerializerMixin {
2020
Branch(this.name, this.isBranch, this.tarballUrl, this.zipballUrl);
2121

2222
factory Branch.fromJson(Map<String, dynamic> json) => _$BranchFromJson(json);
23+
24+
Map<String, dynamic> toJson() => _$BranchToJson(this);
2325
}

lib/common/model/Branch.g.dart

Lines changed: 11 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/common/model/CommitComment.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import 'package:json_annotation/json_annotation.dart';
99
part 'CommitComment.g.dart';
1010

1111
@JsonSerializable()
12-
class CommitComment extends Object with _$CommitCommentSerializerMixin {
12+
class CommitComment{
1313
int id;
1414
String body;
1515
String path;
@@ -41,4 +41,6 @@ class CommitComment extends Object with _$CommitCommentSerializerMixin {
4141
);
4242

4343
factory CommitComment.fromJson(Map<String, dynamic> json) => _$CommitCommentFromJson(json);
44+
45+
Map<String, dynamic> toJson() => _$CommitCommentToJson(this);
4446
}

lib/common/model/CommitComment.g.dart

Lines changed: 35 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/common/model/CommitFile.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:json_annotation/json_annotation.dart';
88
part 'CommitFile.g.dart';
99

1010
@JsonSerializable()
11-
class CommitFile extends Object with _$CommitFileSerializerMixin {
11+
class CommitFile {
1212
String sha;
1313
@JsonKey(name: "filename")
1414
String fileName;
@@ -38,4 +38,6 @@ class CommitFile extends Object with _$CommitFileSerializerMixin {
3838
);
3939

4040
factory CommitFile.fromJson(Map<String, dynamic> json) => _$CommitFileFromJson(json);
41+
42+
Map<String, dynamic> toJson() => _$CommitFileToJson(this);
4143
}

lib/common/model/CommitFile.g.dart

Lines changed: 27 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/common/model/CommitGitInfo.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import 'package:json_annotation/json_annotation.dart';
99
part 'CommitGitInfo.g.dart';
1010

1111
@JsonSerializable()
12-
class CommitGitInfo extends Object with _$CommitGitInfoSerializerMixin {
12+
class CommitGitInfo {
1313
String message;
1414
String url;
1515
@JsonKey(name: "comment_count")
@@ -26,4 +26,7 @@ class CommitGitInfo extends Object with _$CommitGitInfoSerializerMixin {
2626
);
2727

2828
factory CommitGitInfo.fromJson(Map<String, dynamic> json) => _$CommitGitInfoFromJson(json);
29+
30+
31+
Map<String, dynamic> toJson() => _$CommitGitInfoToJson(this);
2932
}

lib/common/model/CommitGitInfo.g.dart

Lines changed: 21 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/common/model/CommitGitUser.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ import 'package:json_annotation/json_annotation.dart';
88
part 'CommitGitUser.g.dart';
99

1010
@JsonSerializable()
11-
class CommitGitUser extends Object with _$CommitGitUserSerializerMixin {
11+
class CommitGitUser{
1212
String name;
1313
String email;
1414
DateTime date;
1515

1616
CommitGitUser(this.name, this.email, this.date);
1717

1818
factory CommitGitUser.fromJson(Map<String, dynamic> json) => _$CommitGitUserFromJson(json);
19+
20+
21+
Map<String, dynamic> toJson() => _$CommitGitUserToJson(this);
1922
}

0 commit comments

Comments
 (0)