Skip to content

Commit 3bc06b9

Browse files
committed
Some nullsafe fixes
1 parent 77e02f3 commit 3bc06b9

Some content is hidden

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

50 files changed

+577
-668
lines changed

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.sessionStorage['GITHUB_TOKEN'] = tokenInput.value!;
7+
window.localStorage['GITHUB_TOKEN'] = tokenInput.value!;
88
tokenInput.onKeyUp.listen((_) {
9-
window.sessionStorage['GITHUB_TOKEN'] = tokenInput.value!;
9+
window.localStorage['GITHUB_TOKEN'] = tokenInput.value!;
1010
});
1111
}

example/languages.dart

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,9 @@ Future<void> main() async {
1414
}
1515

1616
Future<void> loadRepository() async {
17-
String? user = 'dart-lang';
18-
String? reponame = 'sdk';
19-
2017
final params = queryString;
21-
22-
if (params.containsKey('user')) {
23-
user = params['user'];
24-
}
25-
26-
if (params.containsKey('repo')) {
27-
reponame = params['repo'];
28-
}
18+
var user = params['user'] ?? 'dart-lang';
19+
var reponame = params['repo'] ?? 'sdk';
2920

3021
document.getElementById('name')!.setInnerHtml('$user/$reponame');
3122

example/repos.dart

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ List<Repository>? repos;
1010

1111
Map<String, Comparator<Repository>> sorts = {
1212
'stars': (Repository a, Repository b) =>
13-
b.stargazersCount!.compareTo(a.stargazersCount!),
13+
b.stargazersCount.compareTo(a.stargazersCount),
1414
'forks': (Repository a, Repository b) =>
15-
b.forksCount!.compareTo(a.forksCount!),
15+
b.forksCount.compareTo(a.forksCount),
1616
'created': (Repository a, Repository b) =>
1717
b.createdAt!.compareTo(a.createdAt!),
1818
'pushed': (Repository a, Repository b) => b.pushedAt!.compareTo(a.pushedAt!),
19-
'size': (Repository a, Repository b) => b.size!.compareTo(a.size!)
19+
'size': (Repository a, Repository b) => b.size.compareTo(a.size)
2020
};
2121

2222
Future<void> main() async {
@@ -53,8 +53,8 @@ void updateRepos(
5353
<div class="repo" id="repo_${repo.name}">
5454
<div class="line"></div>
5555
<h2><a href="${repo.htmlUrl}">${repo.name}</a></h2>
56-
${repo.description != "" && repo.description != null ? "<b>Description</b>: ${repo.description}<br/>" : ""}
57-
<b>Language</b>: ${repo.language ?? "Unknown"}
56+
${repo.description != "" ? "<b>Description</b>: ${repo.description}<br/>" : ""}
57+
<b>Language</b>: ${repo.language}
5858
<br/>
5959
<b>Default Branch</b>: ${repo.defaultBranch}
6060
<br/>
@@ -79,7 +79,7 @@ void loadRepos([int Function(Repository a, Repository b)? compare]) {
7979
..id = 'title');
8080
}
8181

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

8484
if (queryString.containsKey('user')) {
8585
user = queryString['user'];
@@ -92,10 +92,13 @@ void loadRepos([int Function(Repository a, Repository b)? compare]) {
9292
}
9393
}
9494

95-
compare ??= (a, b) => a.name!.compareTo(b.name!);
95+
compare ??= (a, b) => a.name.compareTo(b.name);
9696

9797
github.repositories.listUserRepositories(user!).toList().then((repos) {
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);
101104
}

example/stars.dart

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,8 @@ Future<void> main() async {
1212
}
1313

1414
void loadStars() {
15-
String? user = 'SpinlockLabs';
16-
String? repo = 'github.dart';
17-
18-
if (queryString.containsKey('user')) {
19-
user = queryString['user'];
20-
}
21-
22-
if (queryString.containsKey('repo')) {
23-
repo = queryString['repo'];
24-
}
15+
var user = queryString['user'] ?? 'SpinlockLabs';
16+
var repo = queryString['repo'] ?? 'github.dart';
2517

2618
querySelector('#title')!.appendText(' for $user/$repo');
2719

example/status.dart

Lines changed: 0 additions & 17 deletions
This file was deleted.

example/status.html

Lines changed: 0 additions & 22 deletions
This file was deleted.

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.sessionStorage);
13+
auth ??= findAuthenticationInMap(window.localStorage);
1414
return auth ?? Authentication.anonymous();
1515
}
1616

lib/src/common/model/authorizations.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:json_annotation/json_annotation.dart';
55
part 'authorizations.g.dart';
66

77
/// Model class for an authorization.
8-
@JsonSerializable(fieldRename: FieldRename.snake)
8+
@JsonSerializable()
99
class Authorization {
1010
Authorization(
1111
{this.id,
@@ -34,7 +34,7 @@ class Authorization {
3434
}
3535

3636
/// Model class for an application of an [Authorization].
37-
@JsonSerializable(fieldRename: FieldRename.snake)
37+
@JsonSerializable()
3838
class AuthorizationApplication {
3939
AuthorizationApplication({this.url, this.name, this.clientId});
4040

@@ -47,7 +47,7 @@ class AuthorizationApplication {
4747
Map<String, dynamic> toJson() => _$AuthorizationApplicationToJson(this);
4848
}
4949

50-
@JsonSerializable(fieldRename: FieldRename.snake)
50+
@JsonSerializable()
5151
class CreateAuthorization {
5252
CreateAuthorization(this.note,
5353
{this.scopes, this.noteUrl, this.clientId, this.clientSecret});

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

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

lib/src/common/model/gists.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class GistHistoryEntry {
124124
}
125125

126126
/// Model class for gist comments.
127-
@JsonSerializable(fieldRename: FieldRename.snake)
127+
@JsonSerializable()
128128
class GistComment {
129129
GistComment({
130130
this.id,
@@ -146,7 +146,7 @@ class GistComment {
146146
}
147147

148148
/// Model class for a new gist comment to be created.
149-
@JsonSerializable(fieldRename: FieldRename.snake)
149+
@JsonSerializable()
150150
class CreateGistComment {
151151
CreateGistComment(this.body);
152152
String? body;

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

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

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