migrate rest of test/ to null-safety (#3207)
diff --git a/lib/src/ignore.dart b/lib/src/ignore.dart
index ade58d0..fbd93e8 100644
--- a/lib/src/ignore.dart
+++ b/lib/src/ignore.dart
@@ -94,7 +94,7 @@
/// [1]: https://git-scm.com/docs/gitignore
/// [2]: https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreignoreCase
Ignore(
- Iterable<String> patterns, {
+ List<String> patterns, {
bool ignoreCase = false,
void Function(String pattern, FormatException exception)? onInvalidPattern,
}) : _rules = _parseIgnorePatterns(
diff --git a/lib/src/rate_limited_scheduler.dart b/lib/src/rate_limited_scheduler.dart
index daeb76f..2d301d3 100644
--- a/lib/src/rate_limited_scheduler.dart
+++ b/lib/src/rate_limited_scheduler.dart
@@ -92,7 +92,9 @@
// become uncaught.
//
// They will still show up for other listeners of the future.
- await completer.future.catchError((_) {});
+ try {
+ await completer.future;
+ } catch (_) {}
}
/// Calls [callback] with a function that can pre-schedule jobs.
diff --git a/test/dependency_override_test.dart b/test/dependency_override_test.dart
index 3cac645..2ea5abc 100644
--- a/test/dependency_override_test.dart
+++ b/test/dependency_override_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
diff --git a/test/deps_test.dart b/test/deps_test.dart
index 2d59ef8..207e8e7 100644
--- a/test/deps_test.dart
+++ b/test/deps_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:test/test.dart';
diff --git a/test/dev_dependency_test.dart b/test/dev_dependency_test.dart
index 471f53c..88f321b 100644
--- a/test/dev_dependency_test.dart
+++ b/test/dev_dependency_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'package:test/test.dart';
import 'descriptor.dart' as d;
diff --git a/test/directory_option_test.dart b/test/directory_option_test.dart
index 541ddd4..2865a69 100644
--- a/test/directory_option_test.dart
+++ b/test/directory_option_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'dart:convert';
import 'package:path/path.dart' as p;
@@ -20,8 +18,8 @@
..serve('foo', '1.0.0')
..serve('foo', '0.1.2')
..serve('bar', '1.2.3'));
- await credentialsFile(globalPackageServer, 'access token').create();
- globalPackageServer
+ await credentialsFile(globalPackageServer!, 'access token').create();
+ globalPackageServer!
.extraHandlers[RegExp('/api/packages/test_pkg/uploaders')] = (request) {
return shelf.Response.ok(
jsonEncode({
diff --git a/test/help_test.dart b/test/help_test.dart
index 7ef96ff..e66f8a4 100644
--- a/test/help_test.dart
+++ b/test/help_test.dart
@@ -2,7 +2,6 @@
// 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.
-// @dart=2.10
import 'package:args/command_runner.dart';
import 'package:pub/src/command_runner.dart' show PubCommandRunner;
diff --git a/test/ignore_test.dart b/test/ignore_test.dart
index 75238b5..42a189a 100644
--- a/test/ignore_test.dart
+++ b/test/ignore_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'dart:io';
import 'package:pub/src/ignore.dart';
@@ -41,10 +39,10 @@
return [path.substring(0, nextSlash == -1 ? path.length : nextSlash)];
}
- Ignore ignoreForDir(String dir) => c.patterns[dir] == null
+ Ignore? ignoreForDir(String dir) => c.patterns[dir] == null
? null
: Ignore(
- c.patterns[dir],
+ c.patterns[dir]!,
onInvalidPattern: (_, __) => hasWarning = true,
ignoreCase: ignoreCase,
);
@@ -87,17 +85,18 @@
for (final c in testData) {
c.paths.forEach((path, expected) {
- if (c.ignoreCase == null) {
+ var ignoreCase = c.ignoreCase;
+ if (ignoreCase == null) {
_testIgnorePath(c, path, expected, false);
_testIgnorePath(c, path, expected, true);
} else {
- _testIgnorePath(c, path, expected, c.ignoreCase);
+ _testIgnorePath(c, path, expected, ignoreCase);
}
});
}
});
- ProcessResult runGit(List<String> args, {String workingDirectory}) {
+ ProcessResult runGit(List<String> args, {String? workingDirectory}) {
final executable = Platform.isWindows ? 'cmd' : 'git';
args = Platform.isWindows ? ['/c', 'git', ...args] : args;
return Process.runSync(executable, args,
@@ -105,24 +104,24 @@
}
group('git', () {
- Directory tmp;
+ Directory? tmp;
setUpAll(() async {
tmp = await Directory.systemTemp.createTemp('package-ignore-test-');
- final ret = runGit(['init'], workingDirectory: tmp.path);
+ final ret = runGit(['init'], workingDirectory: tmp!.path);
expect(ret.exitCode, equals(0),
reason:
'Running "git init" failed. StdErr: ${ret.stderr} StdOut: ${ret.stdout}');
});
tearDownAll(() async {
- await tmp.delete(recursive: true);
+ await tmp!.delete(recursive: true);
tmp = null;
});
tearDown(() async {
- runGit(['clean', '-f', '-d', '-x'], workingDirectory: tmp.path);
+ runGit(['clean', '-f', '-d', '-x'], workingDirectory: tmp!.path);
});
void _testIgnorePath(
@@ -137,7 +136,7 @@
expect(
runGit(
['config', '--local', 'core.ignoreCase', ignoreCase.toString()],
- workingDirectory: tmp.path,
+ workingDirectory: tmp!.path,
).exitCode,
anyOf(0, 1),
reason: 'Running "git config --local core.ignoreCase ..." failed',
@@ -145,17 +144,17 @@
for (final directory in c.patterns.keys) {
final resolvedDirectory =
- directory == '' ? tmp.uri : tmp.uri.resolve(directory + '/');
+ directory == '' ? tmp!.uri : tmp!.uri.resolve(directory + '/');
Directory.fromUri(resolvedDirectory).createSync(recursive: true);
final gitIgnore =
File.fromUri(resolvedDirectory.resolve('.gitignore'));
gitIgnore.writeAsStringSync(
- c.patterns[directory].join('\n') + '\n',
+ c.patterns[directory]!.join('\n') + '\n',
);
}
final process = runGit(
- ['-C', tmp.path, 'check-ignore', '--no-index', path],
- workingDirectory: tmp.path);
+ ['-C', tmp!.path, 'check-ignore', '--no-index', path],
+ workingDirectory: tmp!.path);
expect(process.exitCode, anyOf(0, 1),
reason: 'Running "git check-ignore" failed');
final ignored = process.exitCode == 0;
@@ -172,11 +171,12 @@
for (final c in testData) {
c.paths.forEach((path, expected) {
- if (c.ignoreCase == null) {
+ var ignoreCase = c.ignoreCase;
+ if (ignoreCase == null) {
_testIgnorePath(c, path, expected, false);
_testIgnorePath(c, path, expected, true);
} else {
- _testIgnorePath(c, path, expected, c.ignoreCase);
+ _testIgnorePath(c, path, expected, ignoreCase);
}
});
}
@@ -200,7 +200,7 @@
final bool skipOnWindows;
/// Test with `core.ignoreCase` set to `true`, `false` or both (if `null`).
- final bool ignoreCase;
+ final bool? ignoreCase;
TestData(
this.name,
diff --git a/test/io_test.dart b/test/io_test.dart
index b54bc91..2c529cd 100644
--- a/test/io_test.dart
+++ b/test/io_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'dart:async';
import 'dart:convert';
import 'dart:io';
@@ -463,14 +461,14 @@
}
void testExistencePredicate(String name, bool Function(String path) predicate,
- {bool forFile,
- bool forFileSymlink,
- bool forMultiLevelFileSymlink,
- bool forDirectory,
- bool forDirectorySymlink,
- bool forMultiLevelDirectorySymlink,
- bool forBrokenSymlink,
- bool forMultiLevelBrokenSymlink}) {
+ {required bool forFile,
+ required bool forFileSymlink,
+ required bool forMultiLevelFileSymlink,
+ required bool forDirectory,
+ required bool forDirectorySymlink,
+ required bool forMultiLevelDirectorySymlink,
+ required bool forBrokenSymlink,
+ required bool forMultiLevelBrokenSymlink}) {
group(name, () {
test('returns $forFile for a file', () {
expect(withTempDir((temp) {
diff --git a/test/levenshtein_test.dart b/test/levenshtein_test.dart
index 6d113c7..67361af 100644
--- a/test/levenshtein_test.dart
+++ b/test/levenshtein_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'package:pub/src/levenshtein.dart';
import 'package:test/test.dart';
diff --git a/test/lock_file_test.dart b/test/lock_file_test.dart
index 2faf8c5..4360c7c 100644
--- a/test/lock_file_test.dart
+++ b/test/lock_file_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'package:pub/src/language_version.dart';
import 'package:pub/src/lock_file.dart';
import 'package:pub/src/package_name.dart';
@@ -24,14 +22,14 @@
@override
PackageRef parseRef(String name, description,
- {String containingPath, LanguageVersion languageVersion}) {
+ {String? containingPath, LanguageVersion? languageVersion}) {
if (!description.endsWith(' desc')) throw FormatException('Bad');
return PackageRef(name, this, description);
}
@override
PackageId parseId(String name, Version version, description,
- {String containingPath}) {
+ {String? containingPath}) {
if (!description.endsWith(' desc')) throw FormatException('Bad');
return PackageId(name, this, version, description);
}
@@ -81,13 +79,13 @@
expect(lockFile.packages.length, equals(2));
- var bar = lockFile.packages['bar'];
+ var bar = lockFile.packages['bar']!;
expect(bar.name, equals('bar'));
expect(bar.version, equals(Version(1, 2, 3)));
expect(bar.source, equals(fakeSource));
expect(bar.description, equals('bar desc'));
- var foo = lockFile.packages['foo'];
+ var foo = lockFile.packages['foo']!;
expect(foo.name, equals('foo'));
expect(foo.version, equals(Version(2, 3, 4)));
expect(foo.source, equals(fakeSource));
@@ -102,7 +100,7 @@
version: 1.2.3
description: foo desc
''', sources);
- var foo = lockFile.packages['foo'];
+ var foo = lockFile.packages['foo']!;
expect(foo.source, equals(sources['bad']));
});
@@ -263,7 +261,7 @@
});
expect(
- loadYaml(lockfile.serialize(null)),
+ loadYaml(lockfile.serialize('')),
equals({
'sdks': {'dart': 'any'},
'packages': {
diff --git a/test/must_pub_get_test.dart b/test/must_pub_get_test.dart
index edea182..3451fc7 100644
--- a/test/must_pub_get_test.dart
+++ b/test/must_pub_get_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'dart:async';
import 'dart:convert';
import 'dart:io';
@@ -334,7 +332,7 @@
setUp(() async {
// Avoid using a path dependency because it triggers the full validation
// logic. We want to be sure SDK-validation works without that logic.
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '3.0.0', pubspec: {
'environment': {'sdk': '>=1.0.0 <2.0.0'}
});
@@ -362,7 +360,7 @@
'current Flutter SDK', () async {
// Avoid using a path dependency because it triggers the full validation
// logic. We want to be sure SDK-validation works without that logic.
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '3.0.0', pubspec: {
'environment': {'flutter': '>=1.0.0 <2.0.0'}
});
@@ -524,7 +522,7 @@
group("an overridden dependency's SDK constraint is unmatched", () {
setUp(() async {
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('bar', '1.0.0', pubspec: {
'environment': {'sdk': '0.0.0-fake'}
});
@@ -549,7 +547,7 @@
() async {
// Avoid using a path dependency because it triggers the full validation
// logic. We want to be sure SDK-validation works without that logic.
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '3.0.0', pubspec: {
'environment': {'flutter': '>=1.0.0 <2.0.0'}
});
diff --git a/test/no_packages_dir_test.dart b/test/no_packages_dir_test.dart
index cdd6351..3a88bc5 100644
--- a/test/no_packages_dir_test.dart
+++ b/test/no_packages_dir_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'package:test/test.dart';
import 'descriptor.dart' as d;
diff --git a/test/package_config_file_test.dart b/test/package_config_file_test.dart
index 8cb03f0..82882ae 100644
--- a/test/package_config_file_test.dart
+++ b/test/package_config_file_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/package_list_files_test.dart b/test/package_list_files_test.dart
index 921175d..091001b 100644
--- a/test/package_list_files_test.dart
+++ b/test/package_list_files_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'dart:io';
import 'package:path/path.dart' as p;
@@ -15,8 +13,8 @@
import 'descriptor.dart' as d;
import 'test_pub.dart';
-String root;
-Entrypoint entrypoint;
+late String root;
+Entrypoint? entrypoint;
void main() {
test('lists files recursively', () async {
@@ -35,7 +33,7 @@
createEntrypoint();
expect(
- entrypoint.root.listFiles(),
+ entrypoint!.root.listFiles(),
unorderedEquals([
p.join(root, 'pubspec.yaml'),
p.join(root, 'file1.txt'),
@@ -71,7 +69,7 @@
createEntrypoint();
expect(
- () => entrypoint.root.listFiles(),
+ () => entrypoint!.root.listFiles(),
throwsA(
isA<DataException>().having(
(e) => e.message,
@@ -123,7 +121,7 @@
createEntrypoint();
expect(
- () => entrypoint.root.listFiles(),
+ () => entrypoint!.root.listFiles(),
throwsA(
isA<DataException>().having(
(e) => e.message,
@@ -151,7 +149,7 @@
createEntrypoint();
expect(
- () => entrypoint.root.listFiles(),
+ () => entrypoint!.root.listFiles(),
throwsA(
isA<DataException>().having(
(e) => e.message,
@@ -169,13 +167,13 @@
d.file('.foo', ''),
]).create();
createEntrypoint();
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, '.foo'),
p.join(root, 'pubspec.yaml'),
});
});
group('with git', () {
- d.GitRepoDescriptor repo;
+ late d.GitRepoDescriptor repo;
setUp(() async {
ensureGit();
repo = d.git(appPath, [d.appPubspec()]);
@@ -193,7 +191,7 @@
])
]).create();
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'pubspec.yaml'),
p.join(root, 'file1.txt'),
p.join(root, 'file2.txt'),
@@ -213,7 +211,7 @@
])
]).create();
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'pubspec.yaml'),
p.join(root, 'file2.text'),
p.join(root, 'subdir', 'subfile2.text')
@@ -246,7 +244,7 @@
createEntrypoint(p.join(appPath, 'rep', 'sub'));
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'pubspec.yaml'),
p.join(root, 'file2.text'),
p.join(root, 'file4.gak'),
@@ -266,7 +264,7 @@
createEntrypoint(p.join(appPath, 'packages', 'app'));
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'pubspec.yaml'),
});
});
@@ -286,7 +284,7 @@
});
test('respects its .gitignore with useGitIgnore', () {
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'pubspec.yaml'),
p.join(root, 'submodule', 'file2.text'),
});
@@ -299,7 +297,7 @@
d.dir('subdir', [d.file('pubspec.lock')])
]).create();
- expect(entrypoint.root.listFiles(), {p.join(root, 'pubspec.yaml')});
+ expect(entrypoint!.root.listFiles(), {p.join(root, 'pubspec.yaml')});
});
test('ignores packages directories', () async {
@@ -310,7 +308,7 @@
])
]).create();
- expect(entrypoint.root.listFiles(), {p.join(root, 'pubspec.yaml')});
+ expect(entrypoint!.root.listFiles(), {p.join(root, 'pubspec.yaml')});
});
test('allows pubspec.lock directories', () async {
@@ -320,7 +318,7 @@
])
]).create();
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'pubspec.yaml'),
p.join(root, 'pubspec.lock', 'file.txt')
});
@@ -341,7 +339,7 @@
])
]).create();
- expect(entrypoint.root.listFiles(beneath: 'subdir'), {
+ expect(entrypoint!.root.listFiles(beneath: 'subdir'), {
p.join(root, 'subdir', 'subfile1.txt'),
p.join(root, 'subdir', 'subfile2.txt'),
p.join(root, 'subdir', 'subsubdir', 'subsubfile1.txt'),
@@ -360,7 +358,7 @@
d.dir('lib', [d.file('not_ignored.dart', 'content')]),
]).create();
createEntrypoint();
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'LICENSE'),
p.join(root, 'CHANGELOG.md'),
p.join(root, 'README.md'),
@@ -412,7 +410,7 @@
]).create();
createEntrypoint();
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'pubspec.yaml'),
p.join(root, 'not_ignored_by_gitignore.txt'),
p.join(root, 'ignored_by_gitignore.txt'),
@@ -427,7 +425,7 @@
});
}
-void createEntrypoint([String path]) {
+void createEntrypoint([String? path]) {
path ??= appPath;
root = p.join(d.sandbox, path);
entrypoint = Entrypoint(root, SystemCache(rootDir: root));
diff --git a/test/packages_file_test.dart b/test/packages_file_test.dart
index ce87d7c..67ca572 100644
--- a/test/packages_file_test.dart
+++ b/test/packages_file_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/pub_get_and_upgrade_test.dart b/test/pub_get_and_upgrade_test.dart
index b93d10f..62004a4 100644
--- a/test/pub_get_and_upgrade_test.dart
+++ b/test/pub_get_and_upgrade_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/pub_uploader_test.dart b/test/pub_uploader_test.dart
index c45c8ed..daec6bc 100644
--- a/test/pub_uploader_test.dart
+++ b/test/pub_uploader_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'dart:async';
import 'dart:convert';
@@ -42,11 +40,11 @@
test('adds an uploader', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
var pub = await startPubUploader(
- globalPackageServer, ['--package', 'pkg', 'add', 'email']);
+ globalPackageServer!, ['--package', 'pkg', 'add', 'email']);
- globalPackageServer.expect('POST', '/api/packages/pkg/uploaders',
+ globalPackageServer!.expect('POST', '/api/packages/pkg/uploaders',
(request) {
return request.readAsString().then((body) {
expect(body, equals('email=email'));
@@ -65,11 +63,11 @@
test('removes an uploader', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
var pub = await startPubUploader(
- globalPackageServer, ['--package', 'pkg', 'remove', 'email']);
+ globalPackageServer!, ['--package', 'pkg', 'remove', 'email']);
- globalPackageServer.expect('DELETE', '/api/packages/pkg/uploaders/email',
+ globalPackageServer!.expect('DELETE', '/api/packages/pkg/uploaders/email',
(request) {
return shelf.Response.ok(
jsonEncode({
@@ -86,10 +84,10 @@
await d.validPackage.create();
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPubUploader(globalPackageServer, ['add', 'email']);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPubUploader(globalPackageServer!, ['add', 'email']);
- globalPackageServer.expect('POST', '/api/packages/test_pkg/uploaders',
+ globalPackageServer!.expect('POST', '/api/packages/test_pkg/uploaders',
(request) {
return shelf.Response.ok(
jsonEncode({
@@ -104,11 +102,11 @@
test('add provides an error', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
var pub = await startPubUploader(
- globalPackageServer, ['--package', 'pkg', 'add', 'email']);
+ globalPackageServer!, ['--package', 'pkg', 'add', 'email']);
- globalPackageServer.expect('POST', '/api/packages/pkg/uploaders',
+ globalPackageServer!.expect('POST', '/api/packages/pkg/uploaders',
(request) {
return shelf.Response(400,
body: jsonEncode({
@@ -123,12 +121,12 @@
test('remove provides an error', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
var pub = await startPubUploader(
- globalPackageServer, ['--package', 'pkg', 'remove', 'e/mail']);
+ globalPackageServer!, ['--package', 'pkg', 'remove', 'e/mail']);
- globalPackageServer.expect('DELETE', '/api/packages/pkg/uploaders/e%2Fmail',
- (request) {
+ globalPackageServer!
+ .expect('DELETE', '/api/packages/pkg/uploaders/e%2Fmail', (request) {
return shelf.Response(400,
body: jsonEncode({
'error': {'message': 'Bad job!'}
@@ -142,11 +140,11 @@
test('add provides invalid JSON', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
var pub = await startPubUploader(
- globalPackageServer, ['--package', 'pkg', 'add', 'email']);
+ globalPackageServer!, ['--package', 'pkg', 'add', 'email']);
- globalPackageServer.expect('POST', '/api/packages/pkg/uploaders',
+ globalPackageServer!.expect('POST', '/api/packages/pkg/uploaders',
(request) => shelf.Response.ok('{not json'));
expect(
@@ -158,11 +156,11 @@
test('remove provides invalid JSON', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
var pub = await startPubUploader(
- globalPackageServer, ['--package', 'pkg', 'remove', 'email']);
+ globalPackageServer!, ['--package', 'pkg', 'remove', 'email']);
- globalPackageServer.expect('DELETE', '/api/packages/pkg/uploaders/email',
+ globalPackageServer!.expect('DELETE', '/api/packages/pkg/uploaders/email',
(request) => shelf.Response.ok('{not json'));
expect(
diff --git a/test/pubspec_test.dart b/test/pubspec_test.dart
index c293d85..62f77c4 100644
--- a/test/pubspec_test.dart
+++ b/test/pubspec_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'package:pub/src/language_version.dart';
import 'package:pub/src/package_name.dart';
import 'package:pub/src/pubspec.dart';
@@ -24,14 +22,14 @@
@override
PackageRef parseRef(String name, description,
- {String containingPath, LanguageVersion languageVersion}) {
+ {String? containingPath, LanguageVersion? languageVersion}) {
if (description != 'ok') throw FormatException('Bad');
return PackageRef(name, this, description);
}
@override
PackageId parseId(String name, Version version, description,
- {String containingPath}) =>
+ {String? containingPath}) =>
PackageId(name, this, version, description);
@override
@@ -52,7 +50,7 @@
var throwsPubspecException = throwsA(const TypeMatcher<PubspecException>());
void expectPubspecException(String contents, void Function(Pubspec) fn,
- [String expectedContains]) {
+ [String? expectedContains]) {
var expectation = const TypeMatcher<PubspecException>();
if (expectedContains != null) {
expectation = expectation.having(
@@ -90,7 +88,7 @@
version: ">=1.2.3 <3.4.5"
''', sources);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
expect(foo.constraint.allows(Version(1, 2, 3)), isTrue);
expect(foo.constraint.allows(Version(1, 2, 5)), isTrue);
@@ -105,7 +103,7 @@
version: ">=1.2.3 <0.0.0"
''', sources);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
expect(foo.constraint.isEmpty, isTrue);
});
@@ -126,7 +124,7 @@
version: ">=1.2.3 <3.4.5"
''', sources);
- var foo = pubspec.devDependencies['foo'];
+ var foo = pubspec.devDependencies['foo']!;
expect(foo.name, equals('foo'));
expect(foo.constraint.allows(Version(1, 2, 3)), isTrue);
expect(foo.constraint.allows(Version(1, 2, 5)), isTrue);
@@ -149,7 +147,7 @@
version: ">=1.2.3 <3.4.5"
''', sources);
- var foo = pubspec.dependencyOverrides['foo'];
+ var foo = pubspec.dependencyOverrides['foo']!;
expect(foo.name, equals('foo'));
expect(foo.constraint.allows(Version(1, 2, 3)), isTrue);
expect(foo.constraint.allows(Version(1, 2, 5)), isTrue);
@@ -171,7 +169,7 @@
unknown: blah
''', sources);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
expect(foo.source, equals(sources['unknown']));
});
@@ -183,7 +181,7 @@
version: 1.2.3
''', sources);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
expect(foo.source, equals(sources['hosted']));
});
@@ -310,10 +308,10 @@
sources,
);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
- expect(foo.source.name, 'hosted');
- expect(foo.source.serializeDescription(null, foo.description), {
+ expect(foo.source!.name, 'hosted');
+ expect(foo.source!.serializeDescription('', foo.description), {
'url': 'https://example.org/pub/',
'name': 'bar',
});
@@ -333,10 +331,10 @@
sources,
);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
- expect(foo.source.name, 'hosted');
- expect(foo.source.serializeDescription(null, foo.description), {
+ expect(foo.source!.name, 'hosted');
+ expect(foo.source!.serializeDescription('', foo.description), {
'url': 'https://example.org/pub/',
'name': 'foo',
});
@@ -355,10 +353,10 @@
sources,
);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
- expect(foo.source.name, 'hosted');
- expect(foo.source.serializeDescription(null, foo.description), {
+ expect(foo.source!.name, 'hosted');
+ expect(foo.source!.serializeDescription('', foo.description), {
'url': 'https://example.org/pub/',
'name': 'foo',
});
@@ -377,10 +375,10 @@
sources,
);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
- expect(foo.source.name, 'hosted');
- expect(foo.source.serializeDescription(null, foo.description), {
+ expect(foo.source!.name, 'hosted');
+ expect(foo.source!.serializeDescription('', foo.description), {
'url': 'https://pub.dartlang.org',
'name': 'bar',
});
@@ -402,7 +400,7 @@
() => pubspec.dependencies,
throwsA(
isA<PubspecException>()
- .having((e) => e.span.text, 'span.text', 'invalid value'),
+ .having((e) => e.span!.text, 'span.text', 'invalid value'),
),
);
},
@@ -418,10 +416,10 @@
sources,
);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
- expect(foo.source.name, 'hosted');
- expect(foo.source.serializeDescription(null, foo.description), {
+ expect(foo.source!.name, 'hosted');
+ expect(foo.source!.serializeDescription('', foo.description), {
'url': 'https://pub.dartlang.org',
'name': 'foo',
});
@@ -714,7 +712,7 @@
''', sources);
expect(pubspec.features, contains('foobar'));
- var feature = pubspec.features['foobar'];
+ var feature = pubspec.features['foobar']!;
expect(feature.name, equals('foobar'));
expect(feature.onByDefault, isTrue);
expect(feature.dependencies, isEmpty);
@@ -751,7 +749,7 @@
expect(pubspec.features, contains('foobar'));
- var feature = pubspec.features['foobar'];
+ var feature = pubspec.features['foobar']!;
expect(feature.sdkConstraints,
containsPair('dart', VersionConstraint.parse('^1.0.0')));
expect(feature.sdkConstraints,
@@ -770,7 +768,7 @@
Pubspec.parse('features: {foobar: {default: false}}', sources);
expect(pubspec.features, contains('foobar'));
- expect(pubspec.features['foobar'].onByDefault, isFalse);
+ expect(pubspec.features['foobar']!.onByDefault, isFalse);
});
test('parses valid dependency specifications', () {
@@ -784,7 +782,7 @@
expect(pubspec.features, contains('foobar'));
- var feature = pubspec.features['foobar'];
+ var feature = pubspec.features['foobar']!;
expect(feature.name, equals('foobar'));
expect(feature.onByDefault, isTrue);
expect(feature.dependencies, hasLength(2));
@@ -800,7 +798,7 @@
test('can be null', () {
var pubspec =
Pubspec.parse('features: {foobar: {requires: null}}', sources);
- expect(pubspec.features['foobar'].requires, isEmpty);
+ expect(pubspec.features['foobar']!.requires, isEmpty);
});
test('must be a list', () {
diff --git a/test/pubspec_utils_test.dart b/test/pubspec_utils_test.dart
index 60863f4..6622c1c 100644
--- a/test/pubspec_utils_test.dart
+++ b/test/pubspec_utils_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'package:pub/src/pubspec_utils.dart';
import 'package:pub_semver/pub_semver.dart';
import 'package:test/test.dart';
@@ -47,8 +45,10 @@
});
test('works on compatible version union', () {
- final constraint1 = VersionConstraint.parse('>=1.2.3 <2.0.0');
- final constraint2 = VersionConstraint.parse('>2.2.3 <=4.0.0');
+ final constraint1 =
+ VersionConstraint.parse('>=1.2.3 <2.0.0') as VersionRange;
+ final constraint2 =
+ VersionConstraint.parse('>2.2.3 <=4.0.0') as VersionRange;
final constraint = VersionUnion.fromRanges([constraint1, constraint2]);
final removedUpperBound = stripUpperBound(constraint) as VersionRange;
diff --git a/test/rate_limited_scheduler_test.dart b/test/rate_limited_scheduler_test.dart
index 632efbf..e94bbc7 100644
--- a/test/rate_limited_scheduler_test.dart
+++ b/test/rate_limited_scheduler_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'dart:async';
import 'package:pedantic/pedantic.dart';
@@ -19,8 +17,8 @@
final isBeingProcessed = threeCompleters();
Future<String> f(String i) async {
- isBeingProcessed[i].complete();
- await completers[i].future;
+ isBeingProcessed[i]!.complete();
+ await completers[i]!.future;
return i.toUpperCase();
}
@@ -30,11 +28,11 @@
preschedule('b');
preschedule('c');
await Future.wait(
- [isBeingProcessed['a'].future, isBeingProcessed['b'].future]);
- expect(isBeingProcessed['c'].isCompleted, isFalse);
- completers['a'].complete();
- await isBeingProcessed['c'].future;
- completers['c'].complete();
+ [isBeingProcessed['a']!.future, isBeingProcessed['b']!.future]);
+ expect(isBeingProcessed['c']!.isCompleted, isFalse);
+ completers['a']!.complete();
+ await isBeingProcessed['c']!.future;
+ completers['c']!.complete();
expect(await scheduler.schedule('c'), 'C');
});
});
@@ -45,8 +43,8 @@
final isBeingProcessed = threeCompleters();
Future<String> f(String i) async {
- isBeingProcessed[i].complete();
- await completers[i].future;
+ isBeingProcessed[i]!.complete();
+ await completers[i]!.future;
return i.toUpperCase();
}
@@ -57,18 +55,18 @@
preschedule1('a');
preschedule2('b');
preschedule1('c');
- await isBeingProcessed['a'].future;
+ await isBeingProcessed['a']!.future;
// b, c should not start processing due to rate-limiting.
- expect(isBeingProcessed['b'].isCompleted, isFalse);
- expect(isBeingProcessed['c'].isCompleted, isFalse);
+ expect(isBeingProcessed['b']!.isCompleted, isFalse);
+ expect(isBeingProcessed['c']!.isCompleted, isFalse);
});
- completers['a'].complete();
+ completers['a']!.complete();
// b is removed from the queue, now c should start processing.
- await isBeingProcessed['c'].future;
- completers['c'].complete();
+ await isBeingProcessed['c']!.future;
+ completers['c']!.complete();
expect(await scheduler.schedule('c'), 'C');
// b is not on the queue anymore.
- expect(isBeingProcessed['b'].isCompleted, isFalse);
+ expect(isBeingProcessed['b']!.isCompleted, isFalse);
});
});
@@ -78,27 +76,27 @@
final isBeingProcessed = threeCompleters();
Future<String> f(String i) async {
- isBeingProcessed[i].complete();
- await completers[i].future;
+ isBeingProcessed[i]!.complete();
+ await completers[i]!.future;
return i.toUpperCase();
}
final scheduler = RateLimitedScheduler(f, maxConcurrentOperations: 1);
- Future b;
+ Future? b;
await scheduler.withPrescheduling((preschedule) async {
preschedule('a');
preschedule('b');
- await isBeingProcessed['a'].future;
+ await isBeingProcessed['a']!.future;
// b should not start processing due to rate-limiting.
- expect(isBeingProcessed['b'].isCompleted, isFalse);
+ expect(isBeingProcessed['b']!.isCompleted, isFalse);
b = scheduler.schedule('b');
});
- completers['a'].complete();
+ completers['a']!.complete();
expect(await scheduler.schedule('a'), 'A');
// b was scheduled, so it should get processed now
- await isBeingProcessed['b'].future;
- completers['b'].complete();
+ await isBeingProcessed['b']!.future;
+ completers['b']!.complete();
expect(await b, 'B');
});
@@ -107,14 +105,14 @@
final isBeingProcessed = threeCompleters();
Future<String> f(String i) async {
- isBeingProcessed[i].complete();
- await completers[i].future;
+ isBeingProcessed[i]!.complete();
+ await completers[i]!.future;
return i.toUpperCase();
}
final scheduler = RateLimitedScheduler(f, maxConcurrentOperations: 2);
- completers['a'].complete();
+ completers['a']!.complete();
expect(await scheduler.schedule('a'), 'A');
// Would fail if isBeingProcessed['a'] was completed twice
expect(await scheduler.schedule('a'), 'A');
@@ -125,8 +123,8 @@
final isBeingProcessed = threeCompleters();
Future<String> f(String i) async {
- isBeingProcessed[i].complete();
- await completers[i].future;
+ isBeingProcessed[i]!.complete();
+ await completers[i]!.future;
return i.toUpperCase();
}
@@ -134,12 +132,12 @@
await scheduler.withPrescheduling((preschedule) async {
preschedule('a');
preschedule('b');
- await isBeingProcessed['a'].future;
+ await isBeingProcessed['a']!.future;
final cResult = scheduler.schedule('c');
- expect(isBeingProcessed['b'].isCompleted, isFalse);
- completers['a'].complete();
- completers['c'].complete();
- await isBeingProcessed['c'].future;
+ expect(isBeingProcessed['b']!.isCompleted, isFalse);
+ completers['a']!.complete();
+ completers['c']!.complete();
+ await isBeingProcessed['c']!.future;
// 'c' is done before we allow 'b' to finish processing
expect(await cResult, 'C');
});
@@ -150,8 +148,8 @@
final isBeingProcessed = threeCompleters();
Future<String> f(String i) async {
- isBeingProcessed[i].complete();
- await completers[i].future;
+ isBeingProcessed[i]!.complete();
+ await completers[i]!.future;
return i.toUpperCase();
}
@@ -161,14 +159,15 @@
preschedule('a');
preschedule('b');
preschedule('c');
- await isBeingProcessed['a'].future;
- await isBeingProcessed['b'].future;
- expect(isBeingProcessed['c'].isCompleted, isFalse);
- unawaited(completers['c'].future.catchError((_) {}));
- completers['c'].completeError('errorC');
- completers['a'].completeError('errorA');
- await isBeingProcessed['c'].future;
- completers['b'].completeError('errorB');
+
+ await isBeingProcessed['a']!.future;
+ await isBeingProcessed['b']!.future;
+ expect(isBeingProcessed['c']!.isCompleted, isFalse);
+ unawaited(completers['c']!.future.catchError((_) {}));
+ completers['c']!.completeError('errorC');
+ completers['a']!.completeError('errorA');
+ await isBeingProcessed['c']!.future;
+ completers['b']!.completeError('errorB');
expect(() async => await scheduler.schedule('a'), throwsA('errorA'));
expect(() async => await scheduler.schedule('b'), throwsA('errorB'));
expect(() async => await scheduler.schedule('c'), throwsA('errorC'));
@@ -179,9 +178,9 @@
final completers = threeCompleters();
final isBeingProcessed = threeCompleters();
- Future<String> f(String i) async {
- isBeingProcessed[i].complete();
- await completers[i].future;
+ Future<String?> f(String i) async {
+ isBeingProcessed[i]!.complete();
+ await completers[i]!.future;
return Zone.current['zoneValue'];
}
@@ -198,16 +197,16 @@
}, zoneValues: {'zoneValue': 'C'});
await runZoned(() async {
- await isBeingProcessed['a'].future;
- await isBeingProcessed['b'].future;
+ await isBeingProcessed['a']!.future;
+ await isBeingProcessed['b']!.future;
// This will put 'c' in front of the queue, but in a zone with zoneValue
// bound to S.
final f = expectLater(scheduler.schedule('c'), completion('S'));
- completers['a'].complete();
- completers['b'].complete();
+ completers['a']!.complete();
+ completers['b']!.complete();
expect(await scheduler.schedule('a'), 'A');
expect(await scheduler.schedule('b'), 'B');
- completers['c'].complete();
+ completers['c']!.complete();
await f;
}, zoneValues: {'zoneValue': 'S'});
});
diff --git a/test/real_version_test.dart b/test/real_version_test.dart
index 484a7f6..80afab7 100644
--- a/test/real_version_test.dart
+++ b/test/real_version_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'dart:io';
import 'package:path/path.dart' as path;
diff --git a/test/reformat_ranges_test.dart b/test/reformat_ranges_test.dart
index 4af9cf7..35b085f 100644
--- a/test/reformat_ranges_test.dart
+++ b/test/reformat_ranges_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'package:pub/src/package_name.dart';
import 'package:pub/src/solver/reformat_ranges.dart';
import 'package:pub/src/utils.dart';
diff --git a/test/sdk_test.dart b/test/sdk_test.dart
index e9b7f1d..3f3b00b 100644
--- a/test/sdk_test.dart
+++ b/test/sdk_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:pub/src/io.dart';
diff --git a/test/snapshot_test.dart b/test/snapshot_test.dart
index 6ad44f6..215fcdf 100644
--- a/test/snapshot_test.dart
+++ b/test/snapshot_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:test/test.dart';
@@ -107,7 +105,7 @@
d.file('hello.dart-$versionSuffix.snapshot', contains('hello!'))
]).validate();
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '1.2.4', contents: [
d.dir('bin',
[d.file('hello.dart', "void main() => print('hello 2!');")])
@@ -153,7 +151,7 @@
d.file('hello.dart-$versionSuffix.snapshot', contains('hello!'))
]).validate();
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('bar', '1.2.4', contents: [
d.dir('lib', [d.file('bar.dart', "final message = 'hello 2!';")]),
]);
diff --git a/test/unknown_source_test.dart b/test/unknown_source_test.dart
index 241f9c7..fc53621 100644
--- a/test/unknown_source_test.dart
+++ b/test/unknown_source_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'dart:convert';
import 'package:test/test.dart';
diff --git a/test/upgrade/hosted/warn_about_discontinued_test.dart b/test/upgrade/hosted/warn_about_discontinued_test.dart
index 426e14d..8444c10 100644
--- a/test/upgrade/hosted/warn_about_discontinued_test.dart
+++ b/test/upgrade/hosted/warn_about_discontinued_test.dart
@@ -2,7 +2,6 @@
// 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.
-// @dart=2.10
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
@@ -16,7 +15,7 @@
await d.appDir({'foo': '1.2.3'}).create();
await pubGet();
- globalPackageServer.add((builder) => builder
+ globalPackageServer!.add((builder) => builder
..discontinue('foo')
..discontinue('transitive'));
// We warn only about the direct dependency here:
@@ -27,7 +26,7 @@
No dependencies changed.
1 package is discontinued.
''');
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder.discontinue('foo', replacementText: 'bar'));
// We warn only about the direct dependency here:
await pubUpgrade(output: '''
@@ -57,7 +56,7 @@
]).create();
await pubGet();
- globalPackageServer.add((builder) => builder
+ globalPackageServer!.add((builder) => builder
..discontinue('foo')
..discontinue('transitive'));
@@ -69,7 +68,7 @@
No dependencies changed.
1 package is discontinued.
''');
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder.discontinue('foo', replacementText: 'bar'));
// We warn only about the direct dependency here:
await pubUpgrade(output: '''
diff --git a/test/version_solver_test.dart b/test/version_solver_test.dart
index cf6f65f..261c493 100644
--- a/test/version_solver_test.dart
+++ b/test/version_solver_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
import 'dart:async';
import 'dart:io';
@@ -2974,11 +2972,11 @@
///
/// If [downgrade] is `true`, this runs "pub downgrade" instead of "pub get".
Future expectResolves(
- {Map result,
+ {Map? result,
error,
output,
- int tries,
- Map<String, String> environment,
+ int? tries,
+ Map<String, String>? environment,
bool downgrade = false}) async {
await runPub(
args: [downgrade ? 'downgrade' : 'get'],
@@ -3009,7 +3007,7 @@
// If the dep uses the default hosted source, grab it from the test
// package server rather than pub.dartlang.org.
dep = registry.hosted
- .refFor(dep.name, url: Uri.parse(globalPackageServer.url))
+ .refFor(dep.name, url: Uri.parse(globalPackageServer!.url))
.withConstraint(dep.constraint);
}
expect(dep.allows(id), isTrue, reason: 'Expected $id to match $dep.');
diff --git a/tool/extract_all_pub_dev.dart b/tool/extract_all_pub_dev.dart
index 8d7f049..f96dc5a 100644
--- a/tool/extract_all_pub_dev.dart
+++ b/tool/extract_all_pub_dev.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart=2.10
-
/// This is a manual test that can be run to test the .tar.gz decoding.
/// It will save progress in [statusFileName] such that it doesn't have to be
/// finished in a single run.
@@ -33,7 +31,7 @@
Future<void> main() async {
var alreadyDonePackages = <String>{};
- var failures = <Map<String, dynamic>>[];
+ var failures = <Map<String, dynamic>?>[];
if (fileExists(statusFilename)) {
final json = jsonDecode(readTextFile(statusFilename));
for (final packageName in json['packages'] ?? []) {
diff --git a/tool/test-bin/pub_command_runner.dart b/tool/test-bin/pub_command_runner.dart
index 52eaf73..2be51e8 100644
--- a/tool/test-bin/pub_command_runner.dart
+++ b/tool/test-bin/pub_command_runner.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
/// A trivial embedding of the pub command. Used from tests.
-// @dart = 2.11
import 'dart:convert';
import 'dart:io';
@@ -17,7 +16,7 @@
final _LoggingAnalytics loggingAnalytics = _LoggingAnalytics();
class Runner extends CommandRunner<int> {
- ArgResults _options;
+ late ArgResults _options;
Runner() : super('pub_command_runner', 'Tests the embeddable pub command.') {
final analytics = Platform.environment['_PUB_LOG_ANALYTICS'] == 'true'
@@ -60,7 +59,7 @@
bool get firstRun => false;
@override
- Future sendScreenView(String viewName, {Map<String, String> parameters}) {
+ Future sendScreenView(String viewName, {Map<String, String>? parameters}) {
parameters ??= <String, String>{};
parameters['viewName'] = viewName;
return _log('screenView', parameters);
@@ -68,7 +67,7 @@
@override
Future sendEvent(String category, String action,
- {String label, int value, Map<String, String> parameters}) {
+ {String? label, int? value, Map<String, String>? parameters}) {
parameters ??= <String, String>{};
return _log(
'event',
@@ -82,7 +81,7 @@
@override
Future sendTiming(String variableName, int time,
- {String category, String label}) {
+ {String? category, String? label}) {
return _log('timing', {
'variableName': variableName,
'time': time,