Skip to content

Commit ffd3bd6

Browse files
committed
Strong mode and some fixes
1 parent 599507d commit ffd3bd6

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

lib/src/common/model/issues.dart

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ class Issue {
5858
@ApiName("closed_by")
5959
User closedBy;
6060

61-
static Issue fromJSON(input) {
61+
static Issue fromJSON(Map<String, dynamic> input) {
6262
if (input == null) return null;
6363

64-
var labels = input['labels'];
64+
var labels = input['labels'] as List<Map<String, dynamic>>;
6565
if (labels == null) labels = [];
6666

6767
return new Issue()
@@ -74,9 +74,11 @@ class Issue {
7474
..user = User.fromJSON(input['user'])
7575
..labels = labels.map(IssueLabel.fromJSON).toList(growable: false)
7676
..assignee = User.fromJSON(input['assignee'])
77-
..milestone = Milestone.fromJSON(input['milestone'])
77+
..milestone =
78+
Milestone.fromJSON(input['milestone'] as Map<String, dynamic>)
7879
..commentsCount = input['comments']
79-
..pullRequest = IssuePullRequest.fromJSON(input['pull_request'])
80+
..pullRequest = IssuePullRequest
81+
.fromJSON(input['pull_request'] as Map<String, dynamic>)
8082
..createdAt = parseDateTime(input['created_at'])
8183
..updatedAt = parseDateTime(input['updated_at'])
8284
..closedAt = parseDateTime(input['closed_at'])
@@ -100,7 +102,7 @@ class IssueRequest {
100102
IssueRequest();
101103

102104
String toJSON() {
103-
var map = {};
105+
var map = <String, dynamic>{};
104106
putValue("title", title, map);
105107
putValue("body", body, map);
106108
putValue("labels", labels, map);
@@ -125,7 +127,7 @@ class IssuePullRequest {
125127
@ApiName("patch_url")
126128
String patchUrl;
127129

128-
static IssuePullRequest fromJSON(input) {
130+
static IssuePullRequest fromJSON(Map<String, dynamic> input) {
129131
if (input == null) return null;
130132

131133
return new IssuePullRequest()
@@ -155,7 +157,7 @@ class IssueComment {
155157
@ApiName("issue_url")
156158
String issueUrl;
157159

158-
static IssueComment fromJSON(input) {
160+
static IssueComment fromJSON(Map<String, dynamic> input) {
159161
if (input == null) return null;
160162

161163
return new IssueComment()
@@ -178,7 +180,7 @@ class IssueLabel {
178180
/// Label Color
179181
String color;
180182

181-
static IssueLabel fromJSON(input) {
183+
static IssueLabel fromJSON(Map<String, dynamic> input) {
182184
if (input == null) return null;
183185

184186
assert(input['name'] != null);
@@ -189,6 +191,7 @@ class IssueLabel {
189191
..color = input['color'];
190192
}
191193

194+
@override
192195
String toString() => 'IssueLabel: $name';
193196
}
194197

@@ -232,7 +235,7 @@ class Milestone {
232235
@ApiName("due_on")
233236
DateTime dueOn;
234237

235-
static Milestone fromJSON(input) {
238+
static Milestone fromJSON(Map<String, dynamic> input) {
236239
if (input == null) return null;
237240

238241
return new Milestone()
@@ -261,7 +264,7 @@ class CreateMilestone {
261264
CreateMilestone(this.title);
262265

263266
String toJSON() {
264-
var map = {};
267+
var map = <String, dynamic>{};
265268
putValue("title", title, map);
266269
putValue("state", state, map);
267270
putValue(description, description, map);

test/helper/mock.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class MockWithNamedArgs extends Mock {
1818
log = new LogEntryListNamedArgs(() => _lastNamedArgs);
1919
}
2020

21-
noSuchMethod(Invocation invocation) {
21+
@override
22+
dynamic noSuchMethod(Invocation invocation) {
2223
_lastNamedArgs = invocation.namedArguments;
2324
return super.noSuchMethod(invocation);
2425
}
@@ -41,6 +42,7 @@ class LogEntryListNamedArgs extends LogEntryList {
4142

4243
LogEntryListNamedArgs(this.getLastNamedArgs);
4344

45+
@override
4446
add(LogEntry entry) {
4547
logs.add(new LogEntryNamedArgs(entry, getLastNamedArgs()));
4648
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy