Skip to content

Commit d78ef17

Browse files
committed
Strong mode and some fixes
1 parent b1b6ae1 commit d78ef17

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

lib/src/common/model/repos_stats.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ class ContributorStatistics {
1111
/// Weekly Statistics
1212
List<ContributorWeekStatistics> weeks;
1313

14-
static ContributorStatistics fromJSON(input) {
14+
static ContributorStatistics fromJSON(Map<String, dynamic> input) {
1515
if (input == null) return null;
1616

1717
return new ContributorStatistics()
1818
..author = User.fromJSON(input['author'])
1919
..total = input['total']
20-
..weeks =
21-
input['weeks'].map((it) => ContributorWeekStatistics.fromJSON(it));
20+
..weeks = (input['weeks'] as List<Map<String, dynamic>>)
21+
.map((it) => ContributorWeekStatistics.fromJSON(it));
2222
}
2323
}
2424

@@ -37,7 +37,7 @@ class ContributorWeekStatistics {
3737
/// Number of Commits
3838
int commits;
3939

40-
static ContributorWeekStatistics fromJSON(input) {
40+
static ContributorWeekStatistics fromJSON(Map<String, dynamic> input) {
4141
if (input == null) return null;
4242

4343
return new ContributorWeekStatistics()
@@ -56,12 +56,12 @@ class ContributorParticipation {
5656
/// Commit Counts for the Owner
5757
List<int> owner;
5858

59-
static ContributorParticipation fromJSON(input) {
59+
static ContributorParticipation fromJSON(Map<String, dynamic> input) {
6060
if (input == null) return null;
6161

6262
return new ContributorParticipation()
63-
..all = input['all']
64-
..owner = input['owner'];
63+
..all = input['all'] as List<int>
64+
..owner = input['owner'] as List<int>;
6565
}
6666
}
6767

@@ -76,11 +76,11 @@ class YearCommitCountWeek {
7676
/// Timestamp for Beginning of Week
7777
int timestamp;
7878

79-
static YearCommitCountWeek fromJSON(input) {
79+
static YearCommitCountWeek fromJSON(Map<String, dynamic> input) {
8080
if (input == null) return null;
8181

8282
var c = new YearCommitCountWeek();
83-
c.days = input["days"];
83+
c.days = input["days"] as List<int>;
8484
c.total = input["total"];
8585
c.timestamp = input["week"];
8686
return c;
@@ -98,7 +98,7 @@ class WeeklyChangesCount {
9898
/// Number of Deletions
9999
int deletions;
100100

101-
static WeeklyChangesCount fromJSON(input) {
101+
static WeeklyChangesCount fromJSON(Map<String, dynamic> input) {
102102
if (input == null) return null;
103103
var c = new WeeklyChangesCount();
104104
c.timestamp = input[0];
@@ -119,7 +119,7 @@ class PunchcardEntry {
119119
/// Number of Commits
120120
int commits;
121121

122-
static PunchcardEntry fromJSON(input) {
122+
static PunchcardEntry fromJSON(Map<String, dynamic> input) {
123123
if (input == null) return null;
124124
var c = new PunchcardEntry();
125125
c.weekday = input[0];

lib/src/common/model/repos_statuses.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ class CombinedRepositoryStatus {
1010

1111
CombinedRepositoryStatus();
1212

13-
static CombinedRepositoryStatus fromJSON(input) {
13+
static CombinedRepositoryStatus fromJSON(Map<String, dynamic> input) {
1414
if (input == null) return null;
1515

1616
return new CombinedRepositoryStatus()
1717
..state = input["state"]
1818
..sha = input["sha"]
1919
..totalCount = input["total_count"]
20-
..statuses =
21-
input["statuses"].map((it) => RepositoryStatus.fromJSON(it)).toList()
22-
..repository = Repository.fromJSON(input["repository"]);
20+
..statuses = (input["statuses"] as List<Map<String, dynamic>>)
21+
.map((it) => RepositoryStatus.fromJSON(it))
22+
.toList()
23+
..repository =
24+
Repository.fromJSON(input["repository"] as Map<String, dynamic>);
2325
}
2426
}
2527

@@ -32,7 +34,7 @@ class RepositoryStatus {
3234
String description;
3335
String context;
3436

35-
static RepositoryStatus fromJSON(input) {
37+
static RepositoryStatus fromJSON(Map<String, dynamic> input) {
3638
if (input == null) return null;
3739

3840
return new RepositoryStatus()

lib/src/common/model/search.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ class SearchResults<T> {
99

1010
List<T> items;
1111

12-
static SearchResults fromJSON(input, JSONConverter resultConverter) {
12+
static SearchResults fromJSON(
13+
Map<String, dynamic> input, JSONConverter resultConverter) {
1314
var results = new SearchResults();
1415
results
1516
..totalCount = input['total_count']
@@ -32,7 +33,7 @@ abstract class SearchResult {
3233
}
3334

3435
class RepositorySearchResult extends Repository with SearchResult {
35-
static RepositorySearchResult fromJSON(input) {
36+
static RepositorySearchResult fromJSON(Map<String, dynamic> input) {
3637
var result = new RepositorySearchResult();
3738
Repository.fromJSON(input, result);
3839
result.score = input['score'];

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