Skip to content

Commit a8d10ec

Browse files
committed
null fixes 3
1 parent 3bc06b9 commit a8d10ec

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
- For web: browser specific helper methods have moved. use import `package:github/browser_helper.dart` (renderMarkdown, and createAvatorImage)
7373
- `createGithubClient(...)` has been removed. Just create a GitHub object directly now.
7474
- `findAuthenticationFromEnvironment` now works in both server/flutter and web environments
75-
- On the web, it will check the query string first, then localstorage
75+
- On the web, it will check the query string first, then session storage
7676
- all static methods are now factory constructors
7777
- fromJSON is now fromJson everywhere
7878
- toJSON is now toJson everywhere

example/index.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import 'common.dart';
44
void main() {
55
final tokenInput = querySelector('#token') as InputElement;
66
tokenInput.value = github.auth!.token ?? '';
7-
window.localStorage['GITHUB_TOKEN'] = tokenInput.value!;
7+
window.sessionStorage['GITHUB_TOKEN'] = tokenInput.value!;
88
tokenInput.onKeyUp.listen((_) {
9-
window.localStorage['GITHUB_TOKEN'] = tokenInput.value!;
9+
window.sessionStorage['GITHUB_TOKEN'] = tokenInput.value!;
1010
});
1111
}

example/repos.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void loadRepos([int Function(Repository a, Repository b)? compare]) {
7979
..id = 'title');
8080
}
8181

82-
String? user = 'Workiva';
82+
String? user = 'SpinlockLabs';
8383

8484
if (queryString.containsKey('user')) {
8585
user = queryString['user'];
@@ -98,7 +98,4 @@ void loadRepos([int Function(Repository a, Repository b)? compare]) {
9898
_reposCache = repos;
9999
updateRepos(repos, compare);
100100
});
101-
102-
github.repositories.listTags(RepositorySlug('Workiva','font_face_observer')).toList();
103-
github.issues.listByRepo(RepositorySlug('Workiva','over_react')).toList().then((value) => print);
104101
}

lib/src/browser/xplat_browser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import 'package:github/src/common/xplat_common.dart'
1010
Authentication findAuthenticationFromEnvironment() {
1111
// search the query string parameters first
1212
var auth = findAuthenticationInMap(_parseQuery(window.location.href));
13-
auth ??= findAuthenticationInMap(window.localStorage);
13+
auth ??= findAuthenticationInMap(window.sessionStorage);
1414
return auth ?? Authentication.anonymous();
1515
}
1616

lib/src/common/model/issues.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Issue {
1515
this.state = '',
1616
this.title = '',
1717
this.user,
18-
this.labels = const <IssueLabel>[],
18+
List<IssueLabel>? labels,
1919
this.assignee,
2020
this.milestone,
2121
this.commentsCount = 0,
@@ -25,9 +25,14 @@ class Issue {
2525
this.updatedAt,
2626
this.body = '',
2727
this.closedBy,
28-
});
28+
}) {
29+
if (labels != null) {
30+
this.labels = labels;
31+
}
32+
}
2933

3034
/// Issue Labels
35+
@JsonKey(defaultValue: <IssueLabel>[])
3136
List<IssueLabel> labels = <IssueLabel>[];
3237

3338
@JsonKey(defaultValue: 0)

lib/src/common/model/issues.g.dart

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

0 commit comments

Comments
 (0)