Don't use null safety (yet) (#3112)
It raises errors when rolling into the sdk.
diff --git a/lib/src/authentication/client.dart b/lib/src/authentication/client.dart
index 8360e8a..db7e9d8 100644
--- a/lib/src/authentication/client.dart
+++ b/lib/src/authentication/client.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// ignore_for_file: import_of_legacy_library_into_null_safe
+// @dart=2.11
import 'dart:io';
@@ -69,7 +69,7 @@
// the hostedUrl? Or at least we might need to log request.url to give
// user additional insights on what's happening.
- String? serverMessage;
+ String serverMessage;
try {
final wwwAuthenticateHeaderValue =
@@ -108,7 +108,7 @@
if (serverMessage?.isNotEmpty == true) {
// Only allow printable ASCII, map anything else to whitespace, take
// at-most 1024 characters.
- final truncatedMessage = String.fromCharCodes(serverMessage!.runes
+ final truncatedMessage = String.fromCharCodes(serverMessage.runes
.map((r) => 32 >= r && r <= 127 ? r : 32)
.take(1024));
diff --git a/lib/src/authentication/credential.dart b/lib/src/authentication/credential.dart
index db3b308..d840f6b 100644
--- a/lib/src/authentication/credential.dart
+++ b/lib/src/authentication/credential.dart
@@ -2,7 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// ignore_for_file: import_of_legacy_library_into_null_safe
+// @dart=2.11
+
+import 'package:meta/meta.dart';
import '../exceptions.dart';
import '../source/hosted.dart';
@@ -23,9 +25,9 @@
class Credential {
/// Internal constructor that's only used by [fromJson].
Credential._internal({
- required this.url,
- required this.token,
- required this.unknownFields,
+ @required this.url,
+ @required this.token,
+ @required this.unknownFields,
});
/// Create a new [Credential].
@@ -57,7 +59,7 @@
final Uri url;
/// Authentication token value
- final String? token;
+ final String token;
/// Unknown fields found in pub-tokens.json. The fields might be created by the
/// future version of pub tool. We don't want to override them when using the
diff --git a/lib/src/authentication/token_store.dart b/lib/src/authentication/token_store.dart
index 6f68fe6..24f70fc 100644
--- a/lib/src/authentication/token_store.dart
+++ b/lib/src/authentication/token_store.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// ignore_for_file: import_of_legacy_library_into_null_safe
+// @dart=2.11
import 'dart:convert';
@@ -132,10 +132,10 @@
return found;
}
- /// Returns [Credential] for authenticating given [hostedUrl] or null if no
+ /// Returns [Credential] for authenticating given [hostedUrl] or `null` if no
/// matching credential is found.
- Credential? findCredential(Uri hostedUrl) {
- Credential? matchedCredential;
+ Credential findCredential(Uri hostedUrl) {
+ Credential matchedCredential;
for (final credential in credentials) {
if (credential.url == hostedUrl && credential.isValid()) {
if (matchedCredential == null) {
diff --git a/lib/src/command/token.dart b/lib/src/command/token.dart
index bbe35a6..dafa88f 100644
--- a/lib/src/command/token.dart
+++ b/lib/src/command/token.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// ignore_for_file: import_of_legacy_library_into_null_safe
+// @dart=2.11
import '../command.dart';
import 'token_add.dart';
diff --git a/lib/src/command/token_add.dart b/lib/src/command/token_add.dart
index aa2a2f5..24840f2 100644
--- a/lib/src/command/token_add.dart
+++ b/lib/src/command/token_add.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// ignore_for_file: import_of_legacy_library_into_null_safe
+// @dart=2.11
import 'dart:async';
diff --git a/lib/src/command/token_list.dart b/lib/src/command/token_list.dart
index 56d1cb4..828f004 100644
--- a/lib/src/command/token_list.dart
+++ b/lib/src/command/token_list.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// ignore_for_file: import_of_legacy_library_into_null_safe
+// @dart=2.11
import '../command.dart';
import '../log.dart' as log;
diff --git a/lib/src/command/token_remove.dart b/lib/src/command/token_remove.dart
index df038c2..5db8d51 100644
--- a/lib/src/command/token_remove.dart
+++ b/lib/src/command/token_remove.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// ignore_for_file: import_of_legacy_library_into_null_safe
+// @dart=2.11
import '../command.dart';
import '../exceptions.dart';