[flutter_tools] migrate more unit tests to null safety (#106153)
diff --git a/packages/flutter_tools/lib/src/build_system/targets/assets.dart b/packages/flutter_tools/lib/src/build_system/targets/assets.dart
index f6bd396..a9e186b 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/assets.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/assets.dart
@@ -210,10 +210,10 @@
}
// Step 2: validate top level bundle structure.
- Map<String, Object>? bundle;
+ Map<String, Object?>? bundle;
try {
final Object? rawBundle = json.decode(skSLBundleFile.readAsStringSync());
- if (rawBundle is Map<String, Object>) {
+ if (rawBundle is Map<String, Object?>) {
bundle = rawBundle;
} else {
logger.printError('"$bundle" was not a JSON object: $rawBundle');
diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart
index 6d4db33..dd80b1e 100644
--- a/packages/flutter_tools/lib/src/cache.dart
+++ b/packages/flutter_tools/lib/src/cache.dart
@@ -389,10 +389,10 @@
throw Exception('Could not find file at $versionFilePath');
}
final dynamic data = jsonDecode(versionFile.readAsStringSync());
- if (data is! Map<String, Object>) {
- throw Exception("Expected object of type 'Map<String, Object>' but got one of type '${data.runtimeType}'");
+ if (data is! Map<String, Object?>) {
+ throw Exception("Expected object of type 'Map<String, Object?>' but got one of type '${data.runtimeType}'");
}
- final dynamic version = data['version'];
+ final Object? version = data['version'];
if (version == null) {
throw Exception('Could not parse DevTools version from $version');
}
diff --git a/packages/flutter_tools/lib/src/commands/create_base.dart b/packages/flutter_tools/lib/src/commands/create_base.dart
index d4e2c7a..9d272b7 100644
--- a/packages/flutter_tools/lib/src/commands/create_base.dart
+++ b/packages/flutter_tools/lib/src/commands/create_base.dart
@@ -668,11 +668,11 @@
'templates',
'template_manifest.json',
);
- final Map<String, Object> manifest = json.decode(
+ final Map<String, Object?> manifest = json.decode(
globals.fs.file(manifestPath).readAsStringSync(),
- ) as Map<String, Object>;
+ ) as Map<String, Object?>;
return Set<Uri>.from(
- (manifest['files']! as List<Object>).cast<String>().map<Uri>(
+ (manifest['files']! as List<Object?>).cast<String>().map<Uri>(
(String path) =>
Uri.file(globals.fs.path.join(flutterToolsAbsolutePath, path))),
);
diff --git a/packages/flutter_tools/lib/src/macos/application_package.dart b/packages/flutter_tools/lib/src/macos/application_package.dart
index 691a7f3..54228ce 100644
--- a/packages/flutter_tools/lib/src/macos/application_package.dart
+++ b/packages/flutter_tools/lib/src/macos/application_package.dart
@@ -86,8 +86,8 @@
return null;
}
final Map<String, dynamic> propertyValues = globals.plistParser.parseFile(plistPath);
- final String id = propertyValues[PlistParser.kCFBundleIdentifierKey] as String;
- final String executableName = propertyValues[PlistParser.kCFBundleExecutable] as String;
+ final String? id = propertyValues[PlistParser.kCFBundleIdentifierKey] as String?;
+ final String? executableName = propertyValues[PlistParser.kCFBundleExecutable] as String?;
if (id == null) {
globals.printError('Invalid prebuilt macOS app. Info.plist does not contain bundle identifier');
return null;
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart
index e53335f..f48d084 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart
@@ -1534,7 +1534,7 @@
if (!argParser.options.containsKey(name)) {
return null;
}
- return argResults![name] as String;
+ return argResults![name] as String?;
}
/// Gets the parsed command-line option named [name] as an `int`.
diff --git a/packages/flutter_tools/lib/src/test/coverage_collector.dart b/packages/flutter_tools/lib/src/test/coverage_collector.dart
index 2402cb5..62ad1f6 100644
--- a/packages/flutter_tools/lib/src/test/coverage_collector.dart
+++ b/packages/flutter_tools/lib/src/test/coverage_collector.dart
@@ -117,7 +117,7 @@
);
final Future<void> collectionComplete = testDevice.observatoryUri
- .then((Uri observatoryUri) {
+ .then((Uri? observatoryUri) {
_logMessage('collecting coverage data from $testDevice at $observatoryUri...');
return collect(observatoryUri, libraryNames)
.then<void>((Map<String, dynamic> result) {
diff --git a/packages/flutter_tools/lib/src/test/flutter_platform.dart b/packages/flutter_tools/lib/src/test/flutter_platform.dart
index 60d0cc0..7734ff4 100644
--- a/packages/flutter_tools/lib/src/test/flutter_platform.dart
+++ b/packages/flutter_tools/lib/src/test/flutter_platform.dart
@@ -494,7 +494,7 @@
await Future.any<void>(<Future<void>>[
testDevice.finished,
() async {
- final Uri processObservatoryUri = await testDevice.observatoryUri;
+ final Uri? processObservatoryUri = await testDevice.observatoryUri;
if (processObservatoryUri != null) {
globals.printTrace('test $ourTestCount: Observatory uri is available at $processObservatoryUri');
} else {
diff --git a/packages/flutter_tools/lib/src/test/flutter_tester_device.dart b/packages/flutter_tools/lib/src/test/flutter_tester_device.dart
index 5d239fb..1a243ba 100644
--- a/packages/flutter_tools/lib/src/test/flutter_tester_device.dart
+++ b/packages/flutter_tools/lib/src/test/flutter_tester_device.dart
@@ -47,8 +47,7 @@
}) : assert(shellPath != null), // Please provide the path to the shell in the SKY_SHELL environment variable.
assert(!debuggingOptions.startPaused || enableObservatory),
_gotProcessObservatoryUri = enableObservatory
- // ignore: null_argument_to_non_null_type
- ? Completer<Uri>() : (Completer<Uri>()..complete()),
+ ? Completer<Uri?>() : (Completer<Uri?>()..complete()),
_operatingSystemUtils = OperatingSystemUtils(
fileSystem: fileSystem,
logger: logger,
@@ -73,7 +72,7 @@
final CompileExpression? compileExpression;
final FontConfigManager fontConfigManager;
- final Completer<Uri> _gotProcessObservatoryUri;
+ final Completer<Uri?> _gotProcessObservatoryUri;
final Completer<int> _exitCode = Completer<int>();
Process? _process;
@@ -209,7 +208,7 @@
}
@override
- Future<Uri> get observatoryUri {
+ Future<Uri?> get observatoryUri {
assert(_gotProcessObservatoryUri != null);
return _gotProcessObservatoryUri.future;
}
diff --git a/packages/flutter_tools/lib/src/test/test_compiler.dart b/packages/flutter_tools/lib/src/test/test_compiler.dart
index 8f9d4ea..7b119fd 100644
--- a/packages/flutter_tools/lib/src/test/test_compiler.dart
+++ b/packages/flutter_tools/lib/src/test/test_compiler.dart
@@ -79,7 +79,7 @@
late File outputDill;
Future<String?> compile(Uri mainDart) {
- final Completer<String> completer = Completer<String>();
+ final Completer<String?> completer = Completer<String?>();
if (compilerController.isClosed) {
return Future<String?>.value();
}
@@ -175,7 +175,7 @@
// compiler to avoid reusing compiler that might have gotten into
// a weird state.
if (outputPath == null || compilerOutput!.errorCount > 0) {
- request.result.complete(null);
+ request.result.complete();
await _shutdown();
} else {
if (shouldCopyDillFile) {
diff --git a/packages/flutter_tools/lib/src/test/test_device.dart b/packages/flutter_tools/lib/src/test/test_device.dart
index 42774c2..28ff364 100644
--- a/packages/flutter_tools/lib/src/test/test_device.dart
+++ b/packages/flutter_tools/lib/src/test/test_device.dart
@@ -22,7 +22,7 @@
Future<StreamChannel<String>> start(String entrypointPath);
/// Should complete with null if the observatory is not enabled.
- Future<Uri> get observatoryUri;
+ Future<Uri?> get observatoryUri;
/// Terminates the test device.
Future<void> kill();
diff --git a/packages/flutter_tools/test/general.shard/analytics_test.dart b/packages/flutter_tools/test/general.shard/analytics_test.dart
index 75266cd..6afe65d 100644
--- a/packages/flutter_tools/test/general.shard/analytics_test.dart
+++ b/packages/flutter_tools/test/general.shard/analytics_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:args/command_runner.dart';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/android/android_workflow.dart';
@@ -37,8 +35,8 @@
});
group('analytics', () {
- Directory tempDir;
- Config testConfig;
+ late Directory tempDir;
+ late Config testConfig;
setUp(() {
Cache.flutterRoot = '../..';
@@ -108,7 +106,7 @@
});
testUsingContext('Usage records one feature in experiment setting', () async {
- testConfig.setValue(flutterWebFeature.configSetting, true);
+ testConfig.setValue(flutterWebFeature.configSetting!, true);
final Usage usage = Usage(runningOnBot: true);
usage.sendCommand('test');
@@ -126,9 +124,9 @@
});
testUsingContext('Usage records multiple features in experiment setting', () async {
- testConfig.setValue(flutterWebFeature.configSetting, true);
- testConfig.setValue(flutterLinuxDesktopFeature.configSetting, true);
- testConfig.setValue(flutterMacOSDesktopFeature.configSetting, true);
+ testConfig.setValue(flutterWebFeature.configSetting!, true);
+ testConfig.setValue(flutterLinuxDesktopFeature.configSetting!, true);
+ testConfig.setValue(flutterMacOSDesktopFeature.configSetting!, true);
final Usage usage = Usage(runningOnBot: true);
usage.sendCommand('test');
@@ -150,11 +148,11 @@
});
group('analytics with fakes', () {
- MemoryFileSystem memoryFileSystem;
- FakeStdio fakeStdio;
- TestUsage testUsage;
- FakeClock fakeClock;
- FakeDoctor doctor;
+ late MemoryFileSystem memoryFileSystem;
+ late FakeStdio fakeStdio;
+ late TestUsage testUsage;
+ late FakeClock fakeClock;
+ late FakeDoctor doctor;
setUp(() {
memoryFileSystem = MemoryFileSystem.test();
@@ -211,7 +209,7 @@
testUsingContext('compound command usage path', () async {
final BuildCommand buildCommand = BuildCommand();
- final FlutterCommand buildApkCommand = buildCommand.subcommands['apk'] as FlutterCommand;
+ final FlutterCommand buildApkCommand = buildCommand.subcommands['apk']! as FlutterCommand;
expect(await buildApkCommand.usagePath, 'build/apk');
}, overrides: <Type, Generator>{
@@ -280,7 +278,7 @@
});
group('analytics bots', () {
- Directory tempDir;
+ late Directory tempDir;
setUp(() {
tempDir = globals.fs.systemTempDirectory.createTempSync('flutter_tools_analytics_bots_test.');
@@ -341,8 +339,8 @@
String trackingId,
String applicationName,
String applicationVersion, {
- String analyticsUrl,
- Directory documentDirectory,
+ String? analyticsUrl,
+ Directory? documentDirectory,
}) {
throw const FileSystemException('Could not create file');
}
@@ -368,9 +366,9 @@
bool androidLicenses = false,
bool verbose = true,
bool showColor = true,
- AndroidLicenseValidator androidLicenseValidator,
+ AndroidLicenseValidator? androidLicenseValidator,
bool showPii = true,
- List<ValidatorTask> startedValidatorTasks,
+ List<ValidatorTask>? startedValidatorTasks,
bool sendEvent = true,
}) async {
return diagnoseSucceeds;
diff --git a/packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart b/packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart
index 37246c9..e9be104 100644
--- a/packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart
+++ b/packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:archive/archive.dart';
import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart';
@@ -27,10 +25,10 @@
void main() {
group('gradle build', () {
- BufferLogger logger;
- TestUsage testUsage;
- FileSystem fileSystem;
- FakeProcessManager processManager;
+ late BufferLogger logger;
+ late TestUsage testUsage;
+ late FileSystem fileSystem;
+ late FakeProcessManager processManager;
setUp(() {
processManager = FakeProcessManager.empty();
@@ -99,10 +97,10 @@
return line.contains('Some gradle message');
},
handler: ({
- String line,
- FlutterProject project,
- bool usesAndroidX,
- bool multidexEnabled
+ String? line,
+ FlutterProject? project,
+ bool? usesAndroidX,
+ bool? multidexEnabled
}) async {
handlerCalled = true;
return GradleBuildStatus.exit;
@@ -263,10 +261,10 @@
return false;
},
handler: ({
- String line,
- FlutterProject project,
- bool usesAndroidX,
- bool multidexEnabled
+ String? line,
+ FlutterProject? project,
+ bool? usesAndroidX,
+ bool? multidexEnabled
}) async {
return GradleBuildStatus.retry;
},
@@ -351,10 +349,10 @@
return line.contains('Some gradle message');
},
handler: ({
- String line,
- FlutterProject project,
- bool usesAndroidX,
- bool multidexEnabled
+ String? line,
+ FlutterProject? project,
+ bool? usesAndroidX,
+ bool? multidexEnabled
}) async {
handlerCalled = true;
return GradleBuildStatus.exit;
@@ -517,10 +515,10 @@
return line.contains('Some gradle message');
},
handler: ({
- String line,
- FlutterProject project,
- bool usesAndroidX,
- bool multidexEnabled
+ String? line,
+ FlutterProject? project,
+ bool? usesAndroidX,
+ bool? multidexEnabled
}) async {
return GradleBuildStatus.retry;
},
@@ -595,7 +593,7 @@
.childDirectory('flutter-apk')
.childFile('app-release.apk')
..createSync(recursive: true)
- ..writeAsBytesSync(ZipEncoder().encode(archive));
+ ..writeAsBytesSync(ZipEncoder().encode(archive)!);
fileSystem.file('foo/snapshot.arm64-v8a.json')
..createSync(recursive: true)
diff --git a/packages/flutter_tools/test/general.shard/android/android_sdk_test.dart b/packages/flutter_tools/test/general.shard/android/android_sdk_test.dart
index 35bcda4..95e75fc 100644
--- a/packages/flutter_tools/test/general.shard/android/android_sdk_test.dart
+++ b/packages/flutter_tools/test/general.shard/android/android_sdk_test.dart
@@ -2,23 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:flutter_tools/src/android/android_sdk.dart';
import 'package:flutter_tools/src/base/config.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/globals.dart' as globals;
-import 'package:meta/meta.dart';
import '../../src/common.dart';
import '../../src/context.dart';
void main() {
- MemoryFileSystem fileSystem;
- FakeProcessManager processManager;
- Config config;
+ late MemoryFileSystem fileSystem;
+ late FakeProcessManager processManager;
+ late Config config;
setUp(() {
fileSystem = MemoryFileSystem.test();
@@ -27,22 +24,22 @@
});
group('AndroidSdk', () {
- Directory sdkDir;
+ Directory? sdkDir;
tearDown(() {
if (sdkDir != null) {
- tryToDelete(sdkDir);
+ tryToDelete(sdkDir!);
sdkDir = null;
}
});
testUsingContext('parse sdk', () {
sdkDir = createSdkDirectory(fileSystem: fileSystem);
- config.setValue('android-sdk', sdkDir.path);
+ config.setValue('android-sdk', sdkDir!.path);
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
expect(sdk.latestVersion, isNotNull);
- expect(sdk.latestVersion.sdkLevel, 23);
+ expect(sdk.latestVersion!.sdkLevel, 23);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => FakeProcessManager.any(),
@@ -51,11 +48,11 @@
testUsingContext('parse sdk N', () {
sdkDir = createSdkDirectory(withAndroidN: true, fileSystem: fileSystem);
- config.setValue('android-sdk', sdkDir.path);
+ config.setValue('android-sdk', sdkDir!.path);
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
expect(sdk.latestVersion, isNotNull);
- expect(sdk.latestVersion.sdkLevel, 24);
+ expect(sdk.latestVersion!.sdkLevel, 24);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => FakeProcessManager.any(),
@@ -64,9 +61,9 @@
testUsingContext('returns sdkmanager path under cmdline tools on Linux/macOS', () {
sdkDir = createSdkDirectory(fileSystem: fileSystem);
- config.setValue('android-sdk', sdkDir.path);
+ config.setValue('android-sdk', sdkDir!.path);
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
fileSystem.file(
fileSystem.path.join(sdk.directory.path, 'cmdline-tools', 'latest', 'bin', 'sdkmanager')
).createSync(recursive: true);
@@ -81,9 +78,9 @@
testUsingContext('returns sdkmanager path under cmdline tools (highest version) on Linux/macOS', () {
sdkDir = createSdkDirectory(fileSystem: fileSystem, withSdkManager: false);
- config.setValue('android-sdk', sdkDir.path);
+ config.setValue('android-sdk', sdkDir!.path);
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
final List<String> versions = <String>['3.0', '2.1', '1.0'];
for (final String version in versions) {
fileSystem.file(
@@ -101,9 +98,9 @@
testUsingContext('Does not return sdkmanager under deprecated tools component', () {
sdkDir = createSdkDirectory(fileSystem: fileSystem, withSdkManager: false);
- config.setValue('android-sdk', sdkDir.path);
+ config.setValue('android-sdk', sdkDir!.path);
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
fileSystem.file(
fileSystem.path.join(sdk.directory.path, 'tools/bin/sdkmanager')
).createSync(recursive: true);
@@ -118,14 +115,14 @@
testUsingContext('Can look up cmdline tool from deprecated tools path', () {
sdkDir = createSdkDirectory(fileSystem: fileSystem, withSdkManager: false);
- config.setValue('android-sdk', sdkDir.path);
+ config.setValue('android-sdk', sdkDir!.path);
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
fileSystem.file(
fileSystem.path.join(sdk.directory.path, 'tools/bin/foo')
).createSync(recursive: true);
- expect(sdk.getCmdlineToolsPath('foo', skipOldTools: false), '/.tmp_rand0/flutter_mock_android_sdk.rand0/tools/bin/foo');
+ expect(sdk.getCmdlineToolsPath('foo'), '/.tmp_rand0/flutter_mock_android_sdk.rand0/tools/bin/foo');
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => FakeProcessManager.any(),
@@ -135,9 +132,9 @@
testUsingContext('Caches adb location after first access', () {
sdkDir = createSdkDirectory(fileSystem: fileSystem);
- config.setValue('android-sdk', sdkDir.path);
+ config.setValue('android-sdk', sdkDir!.path);
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
final File adbFile = fileSystem.file(
fileSystem.path.join(sdk.directory.path, 'cmdline-tools', 'adb.exe')
)..createSync(recursive: true);
@@ -156,9 +153,9 @@
testUsingContext('returns sdkmanager.bat path under cmdline tools for windows', () {
sdkDir = createSdkDirectory(fileSystem: fileSystem);
- config.setValue('android-sdk', sdkDir.path);
+ config.setValue('android-sdk', sdkDir!.path);
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
fileSystem.file(
fileSystem.path.join(sdk.directory.path, 'cmdline-tools', 'latest', 'bin', 'sdkmanager.bat')
).createSync(recursive: true);
@@ -174,7 +171,7 @@
testUsingContext('returns sdkmanager version', () {
sdkDir = createSdkDirectory(fileSystem: fileSystem);
- config.setValue('android-sdk', sdkDir.path);
+ config.setValue('android-sdk', sdkDir!.path);
processManager.addCommand(
const FakeCommand(
command: <String>[
@@ -184,7 +181,7 @@
stdout: '26.1.1\n',
),
);
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
expect(sdk.sdkManagerVersion, '26.1.1');
}, overrides: <Type, Generator>{
@@ -202,8 +199,8 @@
'/.tmp_rand0/flutter_mock_android_sdk.rand0/cmdline-tools/latest/bin/sdkmanager',
'--version',
]));
- config.setValue('android-sdk', sdkDir.path);
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ config.setValue('android-sdk', sdkDir!.path);
+ final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
final List<String> validationIssues = sdk.validateSdkWellFormed();
expect(validationIssues.first, 'No valid Android SDK platforms found in'
@@ -219,7 +216,7 @@
testUsingContext('does not throw on sdkmanager version check failure', () {
sdkDir = createSdkDirectory(fileSystem: fileSystem);
- config.setValue('android-sdk', sdkDir.path);
+ config.setValue('android-sdk', sdkDir!.path);
processManager.addCommand(
const FakeCommand(
command: <String>[
@@ -232,7 +229,7 @@
),
);
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
expect(sdk.sdkManagerVersion, isNull);
}, overrides: <Type, Generator>{
@@ -244,11 +241,11 @@
testUsingContext('throws on sdkmanager version check if sdkmanager not found', () {
sdkDir = createSdkDirectory(withSdkManager: false, fileSystem: fileSystem);
- config.setValue('android-sdk', sdkDir.path);
+ config.setValue('android-sdk', sdkDir!.path);
processManager.excludedExecutables.add('/.tmp_rand0/flutter_mock_android_sdk.rand0/cmdline-tools/latest/bin/sdkmanager');
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ final AndroidSdk? sdk = AndroidSdk.locateAndroidSdk();
- expect(() => sdk.sdkManagerVersion, throwsToolExit());
+ expect(() => sdk!.sdkManagerVersion, throwsToolExit());
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
@@ -258,9 +255,9 @@
testUsingContext('returns avdmanager path under cmdline tools', () {
sdkDir = createSdkDirectory(fileSystem: fileSystem);
- config.setValue('android-sdk', sdkDir.path);
+ config.setValue('android-sdk', sdkDir!.path);
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
fileSystem.file(
fileSystem.path.join(sdk.directory.path, 'cmdline-tools', 'latest', 'bin', 'avdmanager')
).createSync(recursive: true);
@@ -275,9 +272,9 @@
testUsingContext('returns avdmanager path under cmdline tools on windows', () {
sdkDir = createSdkDirectory(fileSystem: fileSystem);
- config.setValue('android-sdk', sdkDir.path);
+ config.setValue('android-sdk', sdkDir!.path);
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
fileSystem.file(
fileSystem.path.join(sdk.directory.path, 'cmdline-tools', 'latest', 'bin', 'avdmanager.bat')
).createSync(recursive: true);
@@ -292,9 +289,9 @@
testUsingContext("returns avdmanager path under tools if cmdline doesn't exist", () {
sdkDir = createSdkDirectory(fileSystem: fileSystem);
- config.setValue('android-sdk', sdkDir.path);
+ config.setValue('android-sdk', sdkDir!.path);
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
fileSystem.file(
fileSystem.path.join(sdk.directory.path, 'tools', 'bin', 'avdmanager')
).createSync(recursive: true);
@@ -309,9 +306,9 @@
testUsingContext("returns avdmanager path under tools if cmdline doesn't exist on windows", () {
sdkDir = createSdkDirectory(fileSystem: fileSystem);
- config.setValue('android-sdk', sdkDir.path);
+ config.setValue('android-sdk', sdkDir!.path);
- final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
+ final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
fileSystem.file(
fileSystem.path.join(sdk.directory.path, 'tools', 'bin', 'avdmanager.bat')
).createSync(recursive: true);
@@ -330,7 +327,7 @@
Directory createBrokenSdkDirectory({
bool withAndroidN = false,
bool withSdkManager = true,
- @required FileSystem fileSystem,
+ required FileSystem fileSystem,
}) {
final Directory dir = fileSystem.systemTempDirectory.createTempSync('flutter_mock_android_sdk.');
_createSdkFile(dir, 'licenses/dummy');
@@ -346,7 +343,7 @@
return dir;
}
-void _createSdkFile(Directory dir, String filePath, { String contents }) {
+void _createSdkFile(Directory dir, String filePath, { String? contents }) {
final File file = dir.childFile(filePath);
file.createSync(recursive: true);
if (contents != null) {
@@ -359,7 +356,7 @@
bool withSdkManager = true,
bool withPlatformTools = true,
bool withBuildTools = true,
- @required FileSystem fileSystem,
+ required FileSystem fileSystem,
}) {
final Directory dir = fileSystem.systemTempDirectory.createTempSync('flutter_mock_android_sdk.');
final String exe = globals.platform.isWindows ? '.exe' : '';
diff --git a/packages/flutter_tools/test/general.shard/android/android_studio_test.dart b/packages/flutter_tools/test/general.shard/android/android_studio_test.dart
index 9673129..598eebe 100644
--- a/packages/flutter_tools/test/general.shard/android/android_studio_test.dart
+++ b/packages/flutter_tools/test/general.shard/android/android_studio_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:flutter_tools/src/android/android_studio.dart';
import 'package:flutter_tools/src/base/file_system.dart';
@@ -20,24 +18,24 @@
const String homeLinux = '/home/me';
const String homeMac = '/Users/me';
-const Map<String, dynamic> macStudioInfoPlist = <String, dynamic>{
+const Map<String, Object> macStudioInfoPlist = <String, Object>{
'CFBundleGetInfoString': 'Android Studio 3.3, build AI-182.5107.16.33.5199772. Copyright JetBrains s.r.o., (c) 2000-2018',
'CFBundleShortVersionString': '3.3',
'CFBundleVersion': 'AI-182.5107.16.33.5199772',
- 'JVMOptions': <String, dynamic>{
- 'Properties': <String, dynamic>{
+ 'JVMOptions': <String, Object>{
+ 'Properties': <String, Object>{
'idea.paths.selector': 'AndroidStudio3.3',
'idea.platform.prefix': 'AndroidStudio',
},
},
};
-const Map<String, dynamic> macStudioInfoPlist4_1 = <String, dynamic>{
+const Map<String, Object> macStudioInfoPlist4_1 = <String, Object>{
'CFBundleGetInfoString': 'Android Studio 4.1, build AI-201.8743.12.41.6858069. Copyright JetBrains s.r.o., (c) 2000-2020',
'CFBundleShortVersionString': '4.1',
'CFBundleVersion': 'AI-201.8743.12.41.6858069',
- 'JVMOptions': <String, dynamic>{
- 'Properties': <String, dynamic>{
+ 'JVMOptions': <String, Object>{
+ 'Properties': <String, Object>{
'idea.vendor.name' : 'Google',
'idea.paths.selector': 'AndroidStudio4.1',
'idea.platform.prefix': 'AndroidStudio',
@@ -45,12 +43,12 @@
},
};
-const Map<String, dynamic> macStudioInfoPlist2020_3 = <String, dynamic>{
+const Map<String, Object> macStudioInfoPlist2020_3 = <String, Object>{
'CFBundleGetInfoString': 'Android Studio 2020.3, build AI-203.7717.56.2031.7583922. Copyright JetBrains s.r.o., (c) 2000-2021',
'CFBundleShortVersionString': '2020.3',
'CFBundleVersion': 'AI-203.7717.56.2031.7583922',
- 'JVMOptions': <String, dynamic>{
- 'Properties': <String, dynamic>{
+ 'JVMOptions': <String, Object>{
+ 'Properties': <String, Object>{
'idea.vendor.name' : 'Google',
'idea.paths.selector': 'AndroidStudio2020.3',
'idea.platform.prefix': 'AndroidStudio',
@@ -58,12 +56,12 @@
},
};
-const Map<String, dynamic> macStudioInfoPlistEAP = <String, dynamic>{
+const Map<String, Object> macStudioInfoPlistEAP = <String, Object>{
'CFBundleGetInfoString': 'Android Studio EAP AI-212.5712.43.2112.8233820, build AI-212.5712.43.2112.8233820. Copyright JetBrains s.r.o., (c) 2000-2022',
'CFBundleShortVersionString': 'EAP AI-212.5712.43.2112.8233820',
'CFBundleVersion': 'AI-212.5712.43.2112.8233820',
- 'JVMOptions': <String, dynamic>{
- 'Properties': <String, dynamic>{
+ 'JVMOptions': <String, Object>{
+ 'Properties': <String, Object>{
'idea.vendor.name' : 'Google',
'idea.paths.selector': 'AndroidStudio2021.2',
'idea.platform.prefix': 'AndroidStudio',
@@ -90,7 +88,7 @@
}
void main() {
- FileSystem fileSystem;
+ late FileSystem fileSystem;
setUp(() {
fileSystem = MemoryFileSystem.test();
@@ -105,7 +103,7 @@
globals.fs.file(homeFile).writeAsStringSync(installPath);
final AndroidStudio studio =
- AndroidStudio.fromHomeDot(globals.fs.directory(studioHome));
+ AndroidStudio.fromHomeDot(globals.fs.directory(studioHome))!;
expect(studio, isNotNull);
expect(studio.pluginsPath,
equals('/home/me/.AndroidStudioWithCheese5.0/config/plugins'));
@@ -122,10 +120,10 @@
});
group('pluginsPath on Mac', () {
- FileSystemUtils fsUtils;
- Platform platform;
- FakePlistUtils plistUtils;
- FakeProcessManager processManager;
+ late FileSystemUtils fsUtils;
+ late Platform platform;
+ late FakePlistUtils plistUtils;
+ late FakeProcessManager processManager;
setUp(() {
plistUtils = FakePlistUtils();
@@ -157,8 +155,8 @@
)
);
final AndroidStudio studio = AndroidStudio.fromMacOSBundle(
- globals.fs.directory(studioInApplicationPlistFolder)?.parent?.path,
- );
+ globals.fs.directory(studioInApplicationPlistFolder).parent.path,
+ )!;
expect(studio, isNotNull);
expect(studio.pluginsPath, equals(globals.fs.path.join(
@@ -199,8 +197,8 @@
)
);
final AndroidStudio studio = AndroidStudio.fromMacOSBundle(
- globals.fs.directory(studioInApplicationPlistFolder)?.parent?.path,
- );
+ globals.fs.directory(studioInApplicationPlistFolder).parent.path,
+ )!;
expect(studio, isNotNull);
expect(studio.pluginsPath, equals(globals.fs.path.join(
@@ -241,8 +239,8 @@
)
);
final AndroidStudio studio = AndroidStudio.fromMacOSBundle(
- globals.fs.directory(studioInApplicationPlistFolder)?.parent?.path,
- );
+ globals.fs.directory(studioInApplicationPlistFolder).parent.path,
+ )!;
expect(studio, isNotNull);
expect(studio.pluginsPath, equals(globals.fs.path.join(
@@ -282,8 +280,8 @@
)
);
final AndroidStudio studio = AndroidStudio.fromMacOSBundle(
- globals.fs.directory(studioInApplicationPlistFolder)?.parent?.path,
- );
+ globals.fs.directory(studioInApplicationPlistFolder).parent.path,
+ )!;
expect(studio, isNotNull);
expect(studio.pluginsPath, equals(globals.fs.path.join(
@@ -313,13 +311,13 @@
globals.fs.directory(applicationPlistFolder).createSync(recursive: true);
final String applicationsPlistFilePath = globals.fs.path.join(applicationPlistFolder, 'Info.plist');
- const Map<String, dynamic> jetbrainsInfoPlist = <String, dynamic>{
+ const Map<String, Object> jetbrainsInfoPlist = <String, Object>{
'JetBrainsToolboxApp': 'ignored',
};
plistUtils.fileContents[applicationsPlistFilePath] = jetbrainsInfoPlist;
final String homeDirectoryPlistFolder = globals.fs.path.join(
- globals.fsUtils.homeDirPath,
+ globals.fsUtils.homeDirPath!,
'Applications',
'Android Studio.app',
'Contents',
@@ -438,7 +436,7 @@
plistUtils.fileContents[applicationsPlistFilePath] = macStudioInfoPlist;
final String homeDirectoryPlistFolder = globals.fs.path.join(
- globals.fsUtils.homeDirPath,
+ globals.fsUtils.homeDirPath!,
'Applications',
'Android Studio.app',
'Contents',
@@ -449,7 +447,7 @@
plistUtils.fileContents[homeDirectoryPlistFilePath] = macStudioInfoPlist4_1;
expect(AndroidStudio.allInstalled().length, 2);
- expect(AndroidStudio.latestValid().version, Version(4, 1, 0));
+ expect(AndroidStudio.latestValid()!.version, Version(4, 1, 0));
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
FileSystemUtils: () => fsUtils,
@@ -470,8 +468,8 @@
final String plistFilePath = globals.fs.path.join(studioInApplicationPlistFolder, 'Info.plist');
plistUtils.fileContents[plistFilePath] = macStudioInfoPlist;
final AndroidStudio studio = AndroidStudio.fromMacOSBundle(
- globals.fs.directory(studioInApplicationPlistFolder)?.parent?.path,
- );
+ globals.fs.directory(studioInApplicationPlistFolder).parent.path,
+ )!;
expect(studio, isNotNull);
expect(studio.pluginsPath, equals(globals.fs.path.join(
homeMac,
@@ -490,7 +488,7 @@
});
});
- FileSystem windowsFileSystem;
+ late FileSystem windowsFileSystem;
setUp(() {
windowsFileSystem = MemoryFileSystem.test(style: FileSystemStyle.windows);
@@ -500,8 +498,7 @@
windowsFileSystem.file(r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.1\.home')
..createSync(recursive: true)
..writeAsStringSync(r'C:\Program Files\AndroidStudio');
- windowsFileSystem
- .directory(r'C:\Program Files\AndroidStudio')
+ windowsFileSystem.directory(r'C:\Program Files\AndroidStudio')
.createSync(recursive: true);
final AndroidStudio studio = AndroidStudio.allInstalled().single;
@@ -518,8 +515,7 @@
windowsFileSystem.file(r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.2\.home')
..createSync(recursive: true)
..writeAsStringSync(r'C:\Program Files\AndroidStudio');
- windowsFileSystem
- .directory(r'C:\Program Files\AndroidStudio')
+ windowsFileSystem.directory(r'C:\Program Files\AndroidStudio')
.createSync(recursive: true);
final AndroidStudio studio = AndroidStudio.allInstalled().single;
@@ -536,8 +532,7 @@
windowsFileSystem.file(r'C:\Users\Dash\AppData\Local\Google\AndroidStudio2020.3\.home')
..createSync(recursive: true)
..writeAsStringSync(r'C:\Program Files\AndroidStudio');
- windowsFileSystem
- .directory(r'C:\Program Files\AndroidStudio')
+ windowsFileSystem.directory(r'C:\Program Files\AndroidStudio')
.createSync(recursive: true);
final AndroidStudio studio = AndroidStudio.allInstalled().single;
@@ -554,8 +549,7 @@
windowsFileSystem.file(r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.1\.home')
..createSync(recursive: true)
..writeAsStringSync(r'C:\Program Files\AndroidStudio');
- windowsFileSystem
- .directory(r'C:\Program Files\AndroidStudio')
+ windowsFileSystem.directory(r'C:\Program Files\AndroidStudio')
.createSync(recursive: true);
expect(AndroidStudio.allInstalled(), isEmpty);
@@ -572,8 +566,7 @@
windowsFileSystem.file(r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.2\.home')
..createSync(recursive: true)
..writeAsStringSync(r'C:\Program Files\AndroidStudio');
- windowsFileSystem
- .directory(r'C:\Program Files\AndroidStudio')
+ windowsFileSystem.directory(r'C:\Program Files\AndroidStudio')
.createSync(recursive: true);
expect(AndroidStudio.allInstalled(), isEmpty);
@@ -590,8 +583,7 @@
windowsFileSystem.file(r'C:\Users\Dash\AppData\Local\Google\AndroidStudio2020.3\.home')
..createSync(recursive: true)
..writeAsStringSync(r'C:\Program Files\AndroidStudio');
- windowsFileSystem
- .directory(r'C:\Program Files\AndroidStudio')
+ windowsFileSystem.directory(r'C:\Program Files\AndroidStudio')
.createSync(recursive: true);
expect(AndroidStudio.allInstalled(), isEmpty);
@@ -605,7 +597,7 @@
});
group('Installation detection on Linux', () {
- FileSystemUtils fsUtils;
+ late FileSystemUtils fsUtils;
setUp(() {
fsUtils = FileSystemUtils(
@@ -698,10 +690,10 @@
}
class FakePlistUtils extends Fake implements PlistParser {
- final Map<String, Map<String, dynamic>> fileContents = <String, Map<String, dynamic>>{};
+ final Map<String, Map<String, Object>> fileContents = <String, Map<String, Object>>{};
@override
- Map<String, dynamic> parseFile(String plistFilePath) {
- return fileContents[plistFilePath];
+ Map<String, Object> parseFile(String plistFilePath) {
+ return fileContents[plistFilePath]!;
}
}
diff --git a/packages/flutter_tools/test/general.shard/android/android_studio_validator_test.dart b/packages/flutter_tools/test/general.shard/android/android_studio_validator_test.dart
index 975f439..4f52304 100644
--- a/packages/flutter_tools/test/general.shard/android/android_studio_validator_test.dart
+++ b/packages/flutter_tools/test/general.shard/android/android_studio_validator_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:flutter_tools/src/android/android_studio_validator.dart';
import 'package:flutter_tools/src/base/config.dart';
@@ -24,8 +22,8 @@
);
void main() {
- FileSystem fileSystem;
- FakeProcessManager fakeProcessManager;
+ late FileSystem fileSystem;
+ late FakeProcessManager fakeProcessManager;
setUp(() {
fileSystem = MemoryFileSystem.test();
diff --git a/packages/flutter_tools/test/general.shard/android/deferred_components_prebuild_validator_test.dart b/packages/flutter_tools/test/general.shard/android/deferred_components_prebuild_validator_test.dart
index e8978f2..1495f24 100644
--- a/packages/flutter_tools/test/general.shard/android/deferred_components_prebuild_validator_test.dart
+++ b/packages/flutter_tools/test/general.shard/android/deferred_components_prebuild_validator_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:flutter_tools/src/android/deferred_components_prebuild_validator.dart';
import 'package:flutter_tools/src/android/deferred_components_validator.dart';
@@ -16,11 +14,11 @@
import '../../src/context.dart';
void main() {
- FileSystem fileSystem;
- BufferLogger logger;
- Directory projectDir;
- Platform platform;
- Directory flutterRootDir;
+ late FileSystem fileSystem;
+ late BufferLogger logger;
+ late Directory projectDir;
+ late Platform platform;
+ late Directory flutterRootDir;
setUp(() {
fileSystem = MemoryFileSystem.test();
diff --git a/packages/flutter_tools/test/general.shard/android/gradle_test.dart b/packages/flutter_tools/test/general.shard/android/gradle_test.dart
index 3114249..3d9c48a 100644
--- a/packages/flutter_tools/test/general.shard/android/gradle_test.dart
+++ b/packages/flutter_tools/test/general.shard/android/gradle_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:flutter_tools/src/android/android_sdk.dart';
import 'package:flutter_tools/src/android/gradle.dart';
@@ -33,7 +31,7 @@
Cache.flutterRoot = getFlutterRoot();
group('build artifacts', () {
- FileSystem fileSystem;
+ late FileSystem fileSystem;
setUp(() {
fileSystem = MemoryFileSystem.test();
@@ -194,8 +192,8 @@
});
group('Gradle local.properties', () {
- Artifacts localEngineArtifacts;
- FileSystem fs;
+ late Artifacts localEngineArtifacts;
+ late FileSystem fs;
setUp(() {
fs = MemoryFileSystem.test();
@@ -211,7 +209,7 @@
});
}
- String propertyFor(String key, File file) {
+ String? propertyFor(String key, File file) {
final Iterable<String> result = file.readAsLinesSync()
.where((String line) => line.startsWith('$key='))
.map((String line) => line.split('=')[1]);
@@ -219,10 +217,10 @@
}
Future<void> checkBuildVersion({
- String manifest,
- BuildInfo buildInfo,
- String expectedBuildName,
- String expectedBuildNumber,
+ required String manifest,
+ BuildInfo? buildInfo,
+ String? expectedBuildName,
+ String? expectedBuildNumber,
}) async {
final File manifestFile = globals.fs.file('path/to/project/pubspec.yaml');
manifestFile.createSync(recursive: true);
@@ -457,7 +455,7 @@
});
group('isAppUsingAndroidX', () {
- FileSystem fs;
+ late FileSystem fs;
setUp(() {
fs = MemoryFileSystem.test();
@@ -503,8 +501,8 @@
});
group('printHowToConsumeAar', () {
- BufferLogger logger;
- FileSystem fileSystem;
+ late BufferLogger logger;
+ late FileSystem fileSystem;
setUp(() {
logger = BufferLogger.test();
@@ -694,8 +692,8 @@
// If this test fails, you probably edited templates/app/android.tmpl.
// That's fine, but you now need to add a copy of that file to gradle/settings.gradle.legacy_versions, separated
// from the previous versions by a line that just says ";EOF".
- final File templateSettingsDotGradle = globals.fs.file(globals.fs.path.join(Cache.flutterRoot, 'packages', 'flutter_tools', 'templates', 'app', 'android.tmpl', 'settings.gradle'));
- final File legacySettingsDotGradleFiles = globals.fs.file(globals.fs.path.join(Cache.flutterRoot, 'packages','flutter_tools', 'gradle', 'settings.gradle.legacy_versions'));
+ final File templateSettingsDotGradle = globals.fs.file(globals.fs.path.join(Cache.flutterRoot!, 'packages', 'flutter_tools', 'templates', 'app', 'android.tmpl', 'settings.gradle'));
+ final File legacySettingsDotGradleFiles = globals.fs.file(globals.fs.path.join(Cache.flutterRoot!, 'packages','flutter_tools', 'gradle', 'settings.gradle.legacy_versions'));
expect(
legacySettingsDotGradleFiles.readAsStringSync().split(';EOF').map<String>((String body) => body.trim()),
contains(templateSettingsDotGradle.readAsStringSync().trim()),
diff --git a/packages/flutter_tools/test/general.shard/android/multidex_test.dart b/packages/flutter_tools/test/general.shard/android/multidex_test.dart
index 9f7fcb4..11cf202 100644
--- a/packages/flutter_tools/test/general.shard/android/multidex_test.dart
+++ b/packages/flutter_tools/test/general.shard/android/multidex_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/android/multidex.dart';
diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart
index a312ea9..f44cd20 100644
--- a/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart
+++ b/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:convert';
import 'package:file/file.dart';
@@ -24,9 +22,9 @@
// fixed we fix them here.
// TODO(dantup): Remove this function once the above issue is fixed and
// rolls into Flutter.
- return path?.replaceAll('/', globals.fs.path.separator);
+ return path.replaceAll('/', globals.fs.path.separator);
}
- void writePubspecFile(String path, String name, { String fontsSection }) {
+ void writePubspecFile(String path, String name, { String? fontsSection }) {
if (fontsSection == null) {
fontsSection = '';
} else {
@@ -61,14 +59,14 @@
String expectedAssetManifest,
) async {
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ await bundle.build(packagesPath: '.packages');
for (final String packageName in packages) {
for (final String packageFont in packageFonts) {
final String entryKey = 'packages/$packageName/$packageFont';
expect(bundle.entries.containsKey(entryKey), true);
expect(
- utf8.decode(await bundle.entries[entryKey].contentsAsBytes()),
+ utf8.decode(await bundle.entries[entryKey]!.contentsAsBytes()),
packageFont,
);
}
@@ -76,14 +74,14 @@
for (final String localFont in localFonts) {
expect(bundle.entries.containsKey(localFont), true);
expect(
- utf8.decode(await bundle.entries[localFont].contentsAsBytes()),
+ utf8.decode(await bundle.entries[localFont]!.contentsAsBytes()),
localFont,
);
}
}
expect(
- json.decode(utf8.decode(await bundle.entries['FontManifest.json'].contentsAsBytes())),
+ json.decode(utf8.decode(await bundle.entries['FontManifest.json']!.contentsAsBytes())),
json.decode(expectedAssetManifest),
);
}
@@ -95,7 +93,7 @@
}
group('AssetBundle fonts from packages', () {
- FileSystem testFileSystem;
+ FileSystem? testFileSystem;
setUp(() async {
testFileSystem = MemoryFileSystem(
@@ -103,7 +101,7 @@
? FileSystemStyle.windows
: FileSystemStyle.posix,
);
- testFileSystem.currentDirectory = testFileSystem.systemTempDirectory.createTempSync('flutter_asset_bundle_test.');
+ testFileSystem!.currentDirectory = testFileSystem!.systemTempDirectory.createTempSync('flutter_asset_bundle_test.');
});
testUsingContext('App includes neither font manifest nor fonts when no defines fonts', () async {
@@ -112,7 +110,7 @@
writePubspecFile('p/p/pubspec.yaml', 'test_package');
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ await bundle.build(packagesPath: '.packages');
expect(bundle.entries.length, 3); // LICENSE, AssetManifest, FontManifest
expect(bundle.entries.containsKey('FontManifest.json'), isTrue);
}, overrides: <Type, Generator>{
diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart
index a733bd2..dc4d868 100644
--- a/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart
+++ b/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:convert';
import 'package:file/file.dart';
@@ -24,9 +22,9 @@
// fixed we fix them here.
// TODO(dantup): Remove this function once the above issue is fixed and
// rolls into Flutter.
- return path?.replaceAll('/', globals.fs.path.separator);
+ return path.replaceAll('/', globals.fs.path.separator);
}
- void writePubspecFile(String path, String name, { List<String> assets }) {
+ void writePubspecFile(String path, String name, { List<String>? assets }) {
String assetsSection;
if (assets == null) {
assetsSection = '';
@@ -65,11 +63,11 @@
Future<void> buildAndVerifyAssets(
List<String> assets,
List<String> packages,
- String expectedAssetManifest, {
+ String? expectedAssetManifest, {
bool expectExists = true,
}) async {
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ await bundle.build(packagesPath: '.packages');
for (final String packageName in packages) {
for (final String asset in assets) {
@@ -78,7 +76,7 @@
reason: 'Cannot find key on bundle: $entryKey');
if (expectExists) {
expect(
- utf8.decode(await bundle.entries[entryKey].contentsAsBytes()),
+ utf8.decode(await bundle.entries[entryKey]!.contentsAsBytes()),
asset,
);
}
@@ -87,7 +85,7 @@
if (expectExists) {
expect(
- utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()),
+ utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes()),
expectedAssetManifest,
);
}
@@ -103,7 +101,7 @@
}
}
- FileSystem testFileSystem;
+ late FileSystem testFileSystem;
setUp(() async {
testFileSystem = MemoryFileSystem(
@@ -121,15 +119,15 @@
writePubspecFile('p/p/pubspec.yaml', 'test_package');
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ await bundle.build(packagesPath: '.packages');
expect(bundle.entries.length, 3); // LICENSE, AssetManifest, FontManifest
const String expectedAssetManifest = '{}';
expect(
- utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()),
+ utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes()),
expectedAssetManifest,
);
expect(
- utf8.decode(await bundle.entries['FontManifest.json'].contentsAsBytes()),
+ utf8.decode(await bundle.entries['FontManifest.json']!.contentsAsBytes()),
'[]',
);
}, overrides: <Type, Generator>{
@@ -146,15 +144,15 @@
writeAssets('p/p/', assets);
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ await bundle.build(packagesPath: '.packages');
expect(bundle.entries.length, 3); // LICENSE, AssetManifest, FontManifest
const String expectedAssetManifest = '{}';
expect(
- utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()),
+ utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes()),
expectedAssetManifest,
);
expect(
- utf8.decode(await bundle.entries['FontManifest.json'].contentsAsBytes()),
+ utf8.decode(await bundle.entries['FontManifest.json']!.contentsAsBytes()),
'[]',
);
}, overrides: <Type, Generator>{
@@ -540,7 +538,7 @@
writeAssets('p/p/', assetsOnDisk);
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ await bundle.build(packagesPath: '.packages');
expect(bundle.entries['AssetManifest.json'], isNull,
reason: 'Invalid pubspec.yaml should not generate AssetManifest.json' );
diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_test.dart
index f467db6..00d0dec 100644
--- a/packages/flutter_tools/test/general.shard/asset_bundle_test.dart
+++ b/packages/flutter_tools/test/general.shard/asset_bundle_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:convert';
import 'package:file/file.dart';
@@ -21,7 +19,7 @@
void main() {
group('AssetBundle.build', () {
- FileSystem testFileSystem;
+ late FileSystem testFileSystem;
setUp(() async {
testFileSystem = MemoryFileSystem(
@@ -47,11 +45,11 @@
..writeAsStringSync('');
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ await bundle.build(packagesPath: '.packages');
expect(bundle.entries.length, 1);
const String expectedAssetManifest = '{}';
expect(
- utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()),
+ utf8.decode(await bundle.entries['AssetManifest.json']!.contentsAsBytes()),
expectedAssetManifest,
);
}, overrides: <Type, Generator>{
@@ -71,22 +69,22 @@
- assets/foo/
''');
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ await bundle.build(packagesPath: '.packages');
// Expected assets:
// - asset manifest
// - font manifest
// - license file
// - assets/foo/bar.txt
expect(bundle.entries.length, 4);
- expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), false);
+ expect(bundle.needsBuild(), false);
// Simulate modifying the files by updating the filestat time manually.
globals.fs.file(globals.fs.path.join('assets', 'foo', 'fizz.txt'))
..createSync(recursive: true)
..setLastModifiedSync(packageFile.lastModifiedSync().add(const Duration(hours: 1)));
- expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), true);
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ expect(bundle.needsBuild(), true);
+ await bundle.build(packagesPath: '.packages');
// Expected assets:
// - asset manifest
// - font manifest
@@ -111,14 +109,14 @@
''');
globals.fs.file('.packages').createSync();
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ await bundle.build(packagesPath: '.packages');
// Expected assets:
// - asset manifest
// - font manifest
// - license file
// - assets/foo/bar.txt
expect(bundle.entries.length, 4);
- expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), false);
+ expect(bundle.needsBuild(), false);
// Delete the wildcard directory and update pubspec file.
final DateTime modifiedTime = pubspec.lastModifiedSync().add(const Duration(hours: 1));
@@ -136,8 +134,8 @@
// Even though the previous file was removed, it is left in the
// asset manifest and not updated. This is due to the devfs not
// supporting file deletion.
- expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), true);
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ expect(bundle.needsBuild(), true);
+ await bundle.build(packagesPath: '.packages');
// Expected assets:
// - asset manifest
// - font manifest
@@ -165,14 +163,14 @@
''');
globals.fs.file('.packages').createSync();
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ await bundle.build(packagesPath: '.packages');
// Expected assets:
// - asset manifest
// - font manifest
// - license file
// - assets/foo/bar.txt
expect(bundle.entries.length, 4);
- expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), false);
+ expect(bundle.needsBuild(), false);
}, overrides: <Type, Generator>{
FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(),
@@ -202,7 +200,7 @@
platform: globals.platform,
splitDeferredAssets: true,
).createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages', deferredComponentsEnabled: true);
+ await bundle.build(packagesPath: '.packages', deferredComponentsEnabled: true);
// Expected assets:
// - asset manifest
// - font manifest
@@ -210,8 +208,8 @@
// - assets/foo/bar.txt
expect(bundle.entries.length, 4);
expect(bundle.deferredComponentsEntries.length, 1);
- expect(bundle.deferredComponentsEntries['component1'].length, 2);
- expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), false);
+ expect(bundle.deferredComponentsEntries['component1']!.length, 2);
+ expect(bundle.needsBuild(), false);
}, overrides: <Type, Generator>{
FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(),
@@ -236,7 +234,7 @@
- assets/wild/
''');
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages', deferredComponentsEnabled: false);
+ await bundle.build(packagesPath: '.packages');
// Expected assets:
// - asset manifest
// - font manifest
@@ -244,7 +242,7 @@
// - assets/foo/bar.txt
expect(bundle.entries.length, 6);
expect(bundle.deferredComponentsEntries.isEmpty, true);
- expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), false);
+ expect(bundle.needsBuild(), false);
}, overrides: <Type, Generator>{
FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(),
@@ -274,7 +272,7 @@
platform: globals.platform,
splitDeferredAssets: true,
).createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages', deferredComponentsEnabled: true);
+ await bundle.build(packagesPath: '.packages', deferredComponentsEnabled: true);
// Expected assets:
// - asset manifest
// - font manifest
@@ -282,20 +280,20 @@
// - assets/foo/bar.txt
expect(bundle.entries.length, 4);
expect(bundle.deferredComponentsEntries.length, 1);
- expect(bundle.deferredComponentsEntries['component1'].length, 2);
- expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), false);
+ expect(bundle.deferredComponentsEntries['component1']!.length, 2);
+ expect(bundle.needsBuild(), false);
// Simulate modifying the files by updating the filestat time manually.
globals.fs.file(globals.fs.path.join('assets', 'wild', 'fizz.txt'))
..createSync(recursive: true)
..setLastModifiedSync(packageFile.lastModifiedSync().add(const Duration(hours: 1)));
- expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), true);
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages', deferredComponentsEnabled: true);
+ expect(bundle.needsBuild(), true);
+ await bundle.build(packagesPath: '.packages', deferredComponentsEnabled: true);
expect(bundle.entries.length, 4);
expect(bundle.deferredComponentsEntries.length, 1);
- expect(bundle.deferredComponentsEntries['component1'].length, 3);
+ expect(bundle.deferredComponentsEntries['component1']!.length, 3);
}, overrides: <Type, Generator>{
FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(),
@@ -327,16 +325,16 @@
- assets/foo/bar.txt
''');
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ await bundle.build(packagesPath: '.packages');
- final DevFSStringContent assetManifest = bundle.entries['AssetManifest.json']
- as DevFSStringContent;
- final DevFSStringContent fontManifest = bundle.entries['FontManifest.json']
- as DevFSStringContent;
- final DevFSStringContent license = bundle.entries['NOTICES']
- as DevFSStringContent;
+ final DevFSStringContent? assetManifest = bundle.entries['AssetManifest.json']
+ as DevFSStringContent?;
+ final DevFSStringContent? fontManifest = bundle.entries['FontManifest.json']
+ as DevFSStringContent?;
+ final DevFSStringContent? license = bundle.entries['NOTICES']
+ as DevFSStringContent?;
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ await bundle.build(packagesPath: '.packages');
expect(assetManifest, bundle.entries['AssetManifest.json']);
expect(fontManifest, bundle.entries['FontManifest.json']);
@@ -360,7 +358,7 @@
''');
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- expect(await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'), 0);
+ expect(await bundle.build(packagesPath: '.packages'), 0);
expect(bundle.additionalDependencies.single.path, contains('DOES_NOT_EXIST_RERUN_FOR_WILDCARD'));
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
@@ -381,7 +379,7 @@
''');
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- expect(await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'), 0);
+ expect(await bundle.build(packagesPath: '.packages'), 0);
expect(bundle.additionalDependencies, isEmpty);
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
@@ -390,12 +388,12 @@
group('Shaders: ', () {
- MemoryFileSystem fileSystem;
- Artifacts artifacts;
- String impellerc;
- Directory output;
- String shaderPath;
- String outputPath;
+ late MemoryFileSystem fileSystem;
+ late Artifacts artifacts;
+ late String impellerc;
+ late Directory output;
+ late String shaderPath;
+ late String outputPath;
setUp(() {
artifacts = Artifacts.test();
@@ -422,7 +420,7 @@
''');
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- expect(await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'), 0);
+ expect(await bundle.build(packagesPath: '.packages'), 0);
await writeBundle(output, bundle.entries, loggerOverride: testLogger);
@@ -472,7 +470,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
globals.fs.file('foo/bar/fizz.txt').createSync(recursive: true);
- expect(await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'), 0);
+ expect(await bundle.build(packagesPath: '.packages'), 0);
expect(bundle.additionalDependencies, isEmpty);
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
@@ -506,16 +504,16 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
globals.fs.file('foo/bar/fizz.txt').createSync(recursive: true);
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ await bundle.build(packagesPath: '.packages');
expect(bundle.entries, hasLength(4));
- expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), false);
+ expect(bundle.needsBuild(), false);
// Does not track dependency's wildcard directories.
globals.fs.file(globals.fs.path.join('assets', 'foo', 'bar.txt'))
.deleteSync();
- expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), false);
+ expect(bundle.needsBuild(), false);
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(),
@@ -548,7 +546,7 @@
''');
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- expect(await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'), 1);
+ expect(await bundle.build(packagesPath: '.packages'), 1);
expect(testLogger.errorText, contains('This asset was included from package foo'));
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
@@ -571,7 +569,7 @@
''');
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- expect(await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'), 1);
+ expect(await bundle.build(packagesPath: '.packages'), 1);
expect(testLogger.errorText, isNot(contains('This asset was included from')));
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
@@ -605,9 +603,9 @@
''');
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- expect(await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'), 0);
- expect((bundle.entries['FontManifest.json'] as DevFSStringContent).string, '[]');
- expect((bundle.entries['AssetManifest.json'] as DevFSStringContent).string, '{}');
+ expect(await bundle.build(packagesPath: '.packages'), 0);
+ expect((bundle.entries['FontManifest.json']! as DevFSStringContent).string, '[]');
+ expect((bundle.entries['AssetManifest.json']! as DevFSStringContent).string, '{}');
expect(testLogger.errorText, contains(
'package:foo has `uses-material-design: true` set'
));
@@ -642,7 +640,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- expect(await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'), 0);
+ expect(await bundle.build(packagesPath: '.packages'), 0);
expect(bundle.entries.length, 4);
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
@@ -676,11 +674,11 @@
globals.fs.file('assets/zebra.jpg').createSync();
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- expect(await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'), 0);
- expect((bundle.entries['FontManifest.json'] as DevFSStringContent).string, '[]');
+ expect(await bundle.build(packagesPath: '.packages'), 0);
+ expect((bundle.entries['FontManifest.json']! as DevFSStringContent).string, '[]');
// The assets from deferred components and regular assets
// are both included in alphabetical order
- expect((bundle.entries['AssetManifest.json'] as DevFSStringContent).string, '{"assets/apple.jpg":["assets/apple.jpg"],"assets/bar.jpg":["assets/bar.jpg"],"assets/foo.jpg":["assets/foo.jpg"],"assets/zebra.jpg":["assets/zebra.jpg"]}');
+ expect((bundle.entries['AssetManifest.json']! as DevFSStringContent).string, '{"assets/apple.jpg":["assets/apple.jpg"],"assets/bar.jpg":["assets/bar.jpg"],"assets/foo.jpg":["assets/foo.jpg"],"assets/zebra.jpg":["assets/zebra.jpg"]}');
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(),
diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart
index 7ae9dd1..5b2546c 100644
--- a/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart
+++ b/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:convert';
import 'package:file/file.dart';
@@ -24,11 +22,11 @@
// fixed we fix them here.
// TODO(dantup): Remove this function once the above issue is fixed and
// rolls into Flutter.
- return path?.replaceAll('/', globals.fs.path.separator);
+ return path.replaceAll('/', globals.fs.path.separator);
}
group('AssetBundle asset variants', () {
- FileSystem testFileSystem;
+ late FileSystem testFileSystem;
setUp(() async {
testFileSystem = MemoryFileSystem(
style: globals.platform.isWindows
@@ -67,24 +65,24 @@
}
AssetBundle bundle = AssetBundleFactory.instance.createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ await bundle.build(packagesPath: '.packages');
// The main asset file, /a/b/c/foo, and its variants exist.
for (final String asset in assets) {
expect(bundle.entries.containsKey(asset), true);
- expect(utf8.decode(await bundle.entries[asset].contentsAsBytes()), asset);
+ expect(utf8.decode(await bundle.entries[asset]!.contentsAsBytes()), asset);
}
globals.fs.file(fixPath('a/b/c/foo')).deleteSync();
bundle = AssetBundleFactory.instance.createBundle();
- await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages');
+ await bundle.build(packagesPath: '.packages');
// Now the main asset file, /a/b/c/foo, does not exist. This is OK because
// the /a/b/c/*/foo variants do exist.
expect(bundle.entries.containsKey('a/b/c/foo'), false);
for (final String asset in assets.skip(1)) {
expect(bundle.entries.containsKey(asset), true);
- expect(utf8.decode(await bundle.entries[asset].contentsAsBytes()), asset);
+ expect(utf8.decode(await bundle.entries[asset]!.contentsAsBytes()), asset);
}
}, overrides: <Type, Generator>{
FileSystem: () => testFileSystem,
diff --git a/packages/flutter_tools/test/general.shard/asset_test.dart b/packages/flutter_tools/test/general.shard/asset_test.dart
index 0b13455..128457c 100644
--- a/packages/flutter_tools/test/general.shard/asset_test.dart
+++ b/packages/flutter_tools/test/general.shard/asset_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:flutter_tools/src/asset.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/cache.dart';
@@ -86,5 +84,5 @@
}
Future<String> getValueAsString(String key, AssetBundle asset) async {
- return String.fromCharCodes(await asset.entries[key].contentsAsBytes());
+ return String.fromCharCodes(await asset.entries[key]!.contentsAsBytes());
}
diff --git a/packages/flutter_tools/test/general.shard/build_system/source_test.dart b/packages/flutter_tools/test/general.shard/build_system/source_test.dart
index 182a35b..fc2dab8 100644
--- a/packages/flutter_tools/test/general.shard/build_system/source_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/source_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/platform.dart';
@@ -21,9 +19,9 @@
);
void main() {
- Testbed testbed;
- SourceVisitor visitor;
- Environment environment;
+ late Testbed testbed;
+ late SourceVisitor visitor;
+ late Environment environment;
setUp(() {
testbed = Testbed(setup: () {
@@ -33,7 +31,7 @@
environment = Environment.test(
globals.fs.currentDirectory,
outputDir: outputs,
- artifacts: globals.artifacts, // using real artifacts
+ artifacts: globals.artifacts!, // using real artifacts
processManager: FakeProcessManager.any(),
fileSystem: globals.fs,
// engineVersion being null simulates a local engine.
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart
index cebedb3..427c76e 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/artifacts.dart';
@@ -21,10 +19,10 @@
import '../../../src/fake_process_manager.dart';
void main() {
- FakeProcessManager processManager;
- FileSystem fileSystem;
- Artifacts artifacts;
- Logger logger;
+ late FakeProcessManager processManager;
+ late FileSystem fileSystem;
+ late Artifacts artifacts;
+ late Logger logger;
setUp(() {
logger = BufferLogger.test();
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart
index ed20556..97fab5f 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart
@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
+import 'package:collection/collection.dart' show IterableExtension;
import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/artifacts.dart';
@@ -21,8 +20,8 @@
import '../../../src/context.dart';
void main() {
- Environment environment;
- FileSystem fileSystem;
+ late Environment environment;
+ late FileSystem fileSystem;
setUp(() {
fileSystem = MemoryFileSystem.test();
@@ -75,7 +74,7 @@
final Depfile dependencies = depfileService.parse(depfile);
expect(
- dependencies.inputs.firstWhere((File file) => file.path == '/bar/LICENSE', orElse: () => null),
+ dependencies.inputs.firstWhereOrNull((File file) => file.path == '/bar/LICENSE'),
isNotNull,
);
}, overrides: <Type, Generator>{
@@ -124,7 +123,6 @@
targetPlatform: TargetPlatform.android,
fileSystem: MemoryFileSystem.test(),
logger: BufferLogger.test(),
- engineVersion: null,
), isNull);
});
@@ -136,7 +134,6 @@
targetPlatform: TargetPlatform.android,
fileSystem: MemoryFileSystem.test(),
logger: BufferLogger.test(),
- engineVersion: null,
), throwsException);
});
@@ -152,7 +149,6 @@
targetPlatform: TargetPlatform.android,
fileSystem: fileSystem,
logger: logger,
- engineVersion: null,
), throwsException);
expect(logger.errorText, contains('was not a JSON object'));
});
@@ -169,7 +165,6 @@
targetPlatform: TargetPlatform.android,
fileSystem: fileSystem,
logger: logger,
- engineVersion: null,
), throwsException);
expect(logger.errorText, contains('was not a JSON object'));
});
@@ -214,7 +209,7 @@
fileSystem: fileSystem,
logger: logger,
engineVersion: '2',
- );
+ )!;
expect(await content.contentsAsBytes(), utf8.encode('{"data":{}}'));
expect(logger.errorText, contains('This may lead to less efficient shader caching'));
@@ -238,7 +233,7 @@
fileSystem: fileSystem,
logger: logger,
engineVersion: '2',
- );
+ )!;
expect(await content.contentsAsBytes(), utf8.encode('{"data":{}}'));
expect(logger.errorText, isEmpty);
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart
index 4bed207..92c2d81 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/file_system.dart';
@@ -26,12 +24,12 @@
final Platform macPlatform = FakePlatform(operatingSystem: 'macos', environment: <String, String>{});
void main() {
- FakeProcessManager processManager;
- Environment androidEnvironment;
- Environment iosEnvironment;
- Artifacts artifacts;
- FileSystem fileSystem;
- Logger logger;
+ late FakeProcessManager processManager;
+ late Environment androidEnvironment;
+ late Environment iosEnvironment;
+ late Artifacts artifacts;
+ late FileSystem fileSystem;
+ late Logger logger;
setUp(() {
processManager = FakeProcessManager.empty();
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/dart_plugin_registrant_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/dart_plugin_registrant_test.dart
index 9ede15b..b8cbf28 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/dart_plugin_registrant_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/dart_plugin_registrant_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
// TODO(gspencergoog): Remove this tag once this test's state leaks/test
// dependencies have been fixed.
// https://github.com/flutter/flutter/issues/85160
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart
index 5964744..4963568 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/file_system.dart';
@@ -19,8 +17,8 @@
// These tests perform a simple check to verify if the check/task was executed at all.
// Detailed per-check tests are in android/deferred_components_setup_validator_test.dart.
void main() {
- FileSystem fileSystem;
- BufferLogger logger;
+ late FileSystem fileSystem;
+ late BufferLogger logger;
setUp(() {
logger = BufferLogger.test();
@@ -55,9 +53,9 @@
await validatorTarget.build(environment);
// We check the inputs to determine if the task was executed.
- expect(validatorTarget.validator.inputs.length, 3);
- expect(validatorTarget.validator.inputs[0].path, 'project/pubspec.yaml');
- expect(validatorTarget.validator.inputs[1].path, 'project/android/app/src/main/AndroidManifest.xml');
+ expect(validatorTarget.validator!.inputs.length, 3);
+ expect(validatorTarget.validator!.inputs[0].path, 'project/pubspec.yaml');
+ expect(validatorTarget.validator!.inputs[1].path, 'project/android/app/src/main/AndroidManifest.xml');
});
testUsingContext('checkAgainstLoadingUnitsCache checks runs', () async {
@@ -88,8 +86,8 @@
await validatorTarget.build(environment);
// We check the inputs to determine if the task was executed.
- expect(validatorTarget.validator.inputs.length, 3);
- expect(validatorTarget.validator.inputs[2].path, 'project/deferred_components_loading_units.yaml');
+ expect(validatorTarget.validator!.inputs.length, 3);
+ expect(validatorTarget.validator!.inputs[2].path, 'project/deferred_components_loading_units.yaml');
});
testUsingContext('writeLoadingUnitsCache task runs', () async {
@@ -120,7 +118,7 @@
await validatorTarget.build(environment);
// We check the inputs to determine if the task was executed.
- expect(validatorTarget.validator.outputs.length, 1);
- expect(validatorTarget.validator.outputs[0].path, 'project/deferred_components_loading_units.yaml');
+ expect(validatorTarget.validator!.outputs.length, 1);
+ expect(validatorTarget.validator!.outputs[0].path, 'project/deferred_components_loading_units.yaml');
});
}
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart
index 2603e69..b0674e5 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/artifacts.dart';
@@ -39,11 +37,11 @@
];
void main() {
- Environment environment;
- FileSystem fileSystem;
- FakeProcessManager processManager;
- Artifacts artifacts;
- BufferLogger logger;
+ late Environment environment;
+ late FileSystem fileSystem;
+ late FakeProcessManager processManager;
+ late Artifacts artifacts;
+ late BufferLogger logger;
setUp(() {
fileSystem = MemoryFileSystem.test();
@@ -323,13 +321,13 @@
});
group('copies Flutter.framework', () {
- Directory outputDir;
- File binary;
- FakeCommand copyPhysicalFrameworkCommand;
- FakeCommand lipoCommandNonFatResult;
- FakeCommand lipoVerifyArm64Command;
- FakeCommand bitcodeStripCommand;
- FakeCommand adHocCodesignCommand;
+ late Directory outputDir;
+ late File binary;
+ late FakeCommand copyPhysicalFrameworkCommand;
+ late FakeCommand lipoCommandNonFatResult;
+ late FakeCommand lipoVerifyArm64Command;
+ late FakeCommand bitcodeStripCommand;
+ late FakeCommand adHocCodesignCommand;
setUp(() {
final FileSystem fileSystem = MemoryFileSystem.test();
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/linux_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/linux_test.dart
index 963c217..e6b21fc 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/linux_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/linux_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/artifacts.dart';
@@ -90,7 +88,8 @@
});
// Only required for the test below that still depends on the context.
- FileSystem fileSystem;
+ late FileSystem fileSystem;
+
setUp(() {
fileSystem = MemoryFileSystem.test();
});
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart
index 6922195..68be861 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/artifacts.dart';
@@ -19,16 +17,16 @@
import '../../../src/fake_process_manager.dart';
void main() {
- Environment environment;
- FileSystem fileSystem;
- Artifacts artifacts;
- FakeProcessManager processManager;
- File binary;
- BufferLogger logger;
- FakeCommand copyFrameworkCommand;
- FakeCommand lipoInfoNonFatCommand;
- FakeCommand lipoInfoFatCommand;
- FakeCommand lipoVerifyX86_64Command;
+ late Environment environment;
+ late FileSystem fileSystem;
+ late Artifacts artifacts;
+ late FakeProcessManager processManager;
+ late File binary;
+ late BufferLogger logger;
+ late FakeCommand copyFrameworkCommand;
+ late FakeCommand lipoInfoNonFatCommand;
+ late FakeCommand lipoInfoFatCommand;
+ late FakeCommand lipoVerifyX86_64Command;
setUp(() {
processManager = FakeProcessManager.empty();
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart
index 1b1575d..38c9404 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/file_system.dart';
@@ -30,9 +28,9 @@
];
void main() {
- Testbed testbed;
- Environment environment;
- FakeProcessManager processManager;
+ late Testbed testbed;
+ late Environment environment;
+ late FakeProcessManager processManager;
final Platform linux = FakePlatform(
environment: <String, String>{},
);
@@ -40,7 +38,7 @@
operatingSystem: 'windows',
environment: <String, String>{},
);
- DepfileService depfileService;
+ late DepfileService depfileService;
setUp(() {
testbed = Testbed(setup: () {
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart
index c9c2855..a7d0279 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/artifacts.dart';
@@ -120,7 +118,7 @@
});
// AssetBundleFactory still uses context injection
- FileSystem fileSystem;
+ late FileSystem fileSystem;
setUp(() {
fileSystem = MemoryFileSystem.test(style: FileSystemStyle.windows);
diff --git a/packages/flutter_tools/test/general.shard/bundle_builder_test.dart b/packages/flutter_tools/test/general.shard/bundle_builder_test.dart
index 8c5f949..190400a 100644
--- a/packages/flutter_tools/test/general.shard/bundle_builder_test.dart
+++ b/packages/flutter_tools/test/general.shard/bundle_builder_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/config.dart';
import 'package:flutter_tools/src/base/file_system.dart';
@@ -71,7 +69,7 @@
final String mainPath = globals.fs.path.join('lib', 'main.dart');
const String assetDirPath = 'example';
const String depfilePath = 'example.d';
- Environment env;
+ Environment? env;
final BuildSystem buildSystem = TestBuildSystem.all(
BuildResult(success: true),
(Target target, Environment environment) {
@@ -104,17 +102,17 @@
);
expect(env, isNotNull);
- expect(env.defines[kBuildMode], 'debug');
- expect(env.defines[kTargetPlatform], 'ios');
- expect(env.defines[kTargetFile], mainPath);
- expect(env.defines[kTrackWidgetCreation], 'true');
- expect(env.defines[kExtraFrontEndOptions], 'test1,test2');
- expect(env.defines[kExtraGenSnapshotOptions], 'test3,test4');
- expect(env.defines[kFileSystemRoots], 'test5,test6');
- expect(env.defines[kFileSystemScheme], 'test7');
- expect(env.defines[kDartDefines], encodeDartDefines(<String>['test8', 'test9']));
- expect(env.defines[kIconTreeShakerFlag], 'true');
- expect(env.defines[kDeferredComponents], 'false');
+ expect(env!.defines[kBuildMode], 'debug');
+ expect(env!.defines[kTargetPlatform], 'ios');
+ expect(env!.defines[kTargetFile], mainPath);
+ expect(env!.defines[kTrackWidgetCreation], 'true');
+ expect(env!.defines[kExtraFrontEndOptions], 'test1,test2');
+ expect(env!.defines[kExtraGenSnapshotOptions], 'test3,test4');
+ expect(env!.defines[kFileSystemRoots], 'test5,test6');
+ expect(env!.defines[kFileSystemScheme], 'test7');
+ expect(env!.defines[kDartDefines], encodeDartDefines(<String>['test8', 'test9']));
+ expect(env!.defines[kIconTreeShakerFlag], 'true');
+ expect(env!.defines[kDeferredComponents], 'false');
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(),
diff --git a/packages/flutter_tools/test/general.shard/cache_test.dart b/packages/flutter_tools/test/general.shard/cache_test.dart
index 85b4637..8edda35 100644
--- a/packages/flutter_tools/test/general.shard/cache_test.dart
+++ b/packages/flutter_tools/test/general.shard/cache_test.dart
@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
+import 'package:collection/collection.dart' show IterableExtension;
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart';
@@ -17,7 +16,6 @@
import 'package:flutter_tools/src/dart/pub.dart';
import 'package:flutter_tools/src/flutter_cache.dart';
import 'package:flutter_tools/src/globals.dart' as globals;
-import 'package:meta/meta.dart';
import 'package:test/fake.dart';
import '../src/common.dart';
@@ -41,7 +39,7 @@
);
void main() {
- FakeProcessManager fakeProcessManager;
+ late FakeProcessManager fakeProcessManager;
setUp(() {
fakeProcessManager = FakeProcessManager.empty();
@@ -79,7 +77,7 @@
});
testWithoutContext('should not throw when lock is acquired', () async {
- final String oldRoot = Cache.flutterRoot;
+ final String? oldRoot = Cache.flutterRoot;
Cache.flutterRoot = '';
try {
final FileSystem fileSystem = MemoryFileSystem.test();
@@ -365,7 +363,7 @@
final Directory dir = fileSystem.systemTempDirectory
.listSync(recursive: true)
.whereType<Directory>()
- .singleWhere((Directory directory) => directory.basename == 'bin_dir', orElse: () => null);
+ .singleWhereOrNull((Directory directory) => directory.basename == 'bin_dir')!;
expect(dir, isNotNull);
expect(dir.path, artifactDir.childDirectory('bin_dir').path);
@@ -458,6 +456,7 @@
testWithoutContext('FlutterRunnerDebugSymbols downloads Flutter runner debug symbols', () async {
final FileSystem fileSystem = MemoryFileSystem.test();
final Cache cache = FakeSecondaryCache()
+ ..artifactDirectory = fileSystem.currentDirectory
..version = '123456';
final FakeVersionedPackageResolver packageResolver = FakeVersionedPackageResolver();
@@ -974,9 +973,9 @@
});
group('AndroidMavenArtifacts', () {
- MemoryFileSystem memoryFileSystem;
- Cache cache;
- FakeAndroidSdk fakeAndroidSdk;
+ MemoryFileSystem? memoryFileSystem;
+ Cache? cache;
+ FakeAndroidSdk? fakeAndroidSdk;
setUp(() {
memoryFileSystem = MemoryFileSystem.test();
@@ -988,25 +987,25 @@
});
testWithoutContext('AndroidMavenArtifacts has a specified development artifact', () async {
- final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(cache, platform: FakePlatform());
+ final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(cache!, platform: FakePlatform());
expect(mavenArtifacts.developmentArtifact, DevelopmentArtifact.androidMaven);
});
testUsingContext('AndroidMavenArtifacts can invoke Gradle resolve dependencies if Android SDK is present', () async {
- final String oldRoot = Cache.flutterRoot;
+ final String? oldRoot = Cache.flutterRoot;
Cache.flutterRoot = '';
try {
- final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(cache, platform: FakePlatform());
- expect(await mavenArtifacts.isUpToDate(memoryFileSystem), isFalse);
+ final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(cache!, platform: FakePlatform());
+ expect(await mavenArtifacts.isUpToDate(memoryFileSystem!), isFalse);
- final Directory gradleWrapperDir = cache.getArtifactDirectory('gradle_wrapper')..createSync(recursive: true);
+ final Directory gradleWrapperDir = cache!.getArtifactDirectory('gradle_wrapper')..createSync(recursive: true);
gradleWrapperDir.childFile('gradlew').writeAsStringSync('irrelevant');
gradleWrapperDir.childFile('gradlew.bat').writeAsStringSync('irrelevant');
- await mavenArtifacts.update(FakeArtifactUpdater(), BufferLogger.test(), memoryFileSystem, FakeOperatingSystemUtils());
+ await mavenArtifacts.update(FakeArtifactUpdater(), BufferLogger.test(), memoryFileSystem!, FakeOperatingSystemUtils());
- expect(await mavenArtifacts.isUpToDate(memoryFileSystem), isFalse);
- expect(fakeAndroidSdk.reinitialized, true);
+ expect(await mavenArtifacts.isUpToDate(memoryFileSystem!), isFalse);
+ expect(fakeAndroidSdk!.reinitialized, true);
} finally {
Cache.flutterRoot = oldRoot;
}
@@ -1028,12 +1027,12 @@
});
testUsingContext('AndroidMavenArtifacts is a no-op if the Android SDK is absent', () async {
- final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(cache, platform: FakePlatform());
- expect(await mavenArtifacts.isUpToDate(memoryFileSystem), isFalse);
+ final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(cache!, platform: FakePlatform());
+ expect(await mavenArtifacts.isUpToDate(memoryFileSystem!), isFalse);
- await mavenArtifacts.update(FakeArtifactUpdater(), BufferLogger.test(), memoryFileSystem, FakeOperatingSystemUtils());
+ await mavenArtifacts.update(FakeArtifactUpdater(), BufferLogger.test(), memoryFileSystem!, FakeOperatingSystemUtils());
- expect(await mavenArtifacts.isUpToDate(memoryFileSystem), isFalse);
+ expect(await mavenArtifacts.isUpToDate(memoryFileSystem!), isFalse);
}, overrides: <Type, Generator>{
Cache: () => cache,
FileSystem: () => memoryFileSystem,
@@ -1046,8 +1045,8 @@
class FakeCachedArtifact extends EngineCachedArtifact {
FakeCachedArtifact({
String stampName = 'STAMP',
- @required Cache cache,
- DevelopmentArtifact requiredArtifacts,
+ required Cache cache,
+ required DevelopmentArtifact requiredArtifacts,
this.binaryDirs = const <List<String>>[],
this.licenseDirs = const <String>[],
this.packageDirs = const <String>[],
@@ -1081,7 +1080,7 @@
class FakeSecondaryCachedArtifact extends Fake implements CachedArtifact {
bool upToDate = false;
bool didUpdate = false;
- Exception updateException;
+ Exception? updateException;
@override
Future<bool> isUpToDate(FileSystem fileSystem) async => upToDate;
@@ -1089,7 +1088,7 @@
@override
Future<void> update(ArtifactUpdater artifactUpdater, Logger logger, FileSystem fileSystem, OperatingSystemUtils operatingSystemUtils, {bool offline = false}) async {
if (updateException != null) {
- throw updateException;
+ throw updateException!;
}
didUpdate = true;
}
@@ -1107,10 +1106,10 @@
}
class FakeSecondaryCache extends Fake implements Cache {
- Directory downloadDir;
- Directory artifactDirectory;
- String version;
- void Function(String artifactName, String version) onSetStamp;
+ Directory? downloadDir;
+ late Directory artifactDirectory;
+ String? version;
+ late void Function(String artifactName, String version) onSetStamp;
@override
String get storageBaseUrl => 'https://storage.googleapis.com';
@@ -1132,7 +1131,7 @@
}
@override
- String getVersionFor(String artifactName) => version;
+ String? getVersionFor(String artifactName) => version;
@override
void setStampFor(String artifactName, String version) {
@@ -1155,13 +1154,13 @@
@override
Future<void> get({
- PubContext context,
- String directory,
+ PubContext? context,
+ String? directory,
bool skipIfAbsent = false,
bool upgrade = false,
bool offline = false,
bool generateSyntheticPackage = false,
- String flutterRootOverride,
+ String? flutterRootOverride,
bool checkUpToDate = false,
bool shouldSkipThirdPartyGenerator = true,
bool printProgress = true,
@@ -1172,19 +1171,15 @@
class FakeCache extends Cache {
FakeCache({
- @required Logger logger,
- @required FileSystem fileSystem,
- @required Platform platform,
- @required OperatingSystemUtils osUtils,
+ required super.logger,
+ required super.fileSystem,
+ required super.platform,
+ required super.osUtils,
}) : super(
- logger: logger,
- fileSystem: fileSystem,
- platform: platform,
- osUtils: osUtils,
artifacts: <ArtifactSet>[],
);
- File stampFile;
+ late File stampFile;
@override
File getStampFileFor(String artifactName) {
@@ -1202,8 +1197,8 @@
}
class FakeArtifactUpdater extends Fake implements ArtifactUpdater {
- void Function(String, Uri, Directory) onDownloadZipArchive;
- void Function(String, Uri, Directory) onDownloadZipTarball;
+ void Function(String, Uri, Directory)? onDownloadZipArchive;
+ void Function(String, Uri, Directory)? onDownloadZipTarball;
@override
Future<void> downloadZippedTarball(String message, Uri url, Directory location) async {
diff --git a/packages/flutter_tools/test/general.shard/channel_test.dart b/packages/flutter_tools/test/general.shard/channel_test.dart
index ca26708..847e965 100644
--- a/packages/flutter_tools/test/general.shard/channel_test.dart
+++ b/packages/flutter_tools/test/general.shard/channel_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
// TODO(gspencergoog): Remove this tag once this test's state leaks/test
// dependencies have been fixed.
// https://github.com/flutter/flutter/issues/85160
@@ -24,7 +22,7 @@
void main() {
group('channel', () {
- FakeProcessManager fakeProcessManager;
+ late FakeProcessManager fakeProcessManager;
setUp(() {
fakeProcessManager = FakeProcessManager.empty();
@@ -159,7 +157,7 @@
final Iterable<String> rows = testLogger.statusText
.split('\n')
.map((String line) => line.trim())
- .where((String line) => line?.isNotEmpty == true)
+ .where((String line) => line.isNotEmpty == true)
.skip(1); // remove `Flutter channels:` line
expect(rows, <String>['beta', 'stable', 'Currently not on an official channel.']);
@@ -190,7 +188,7 @@
final Iterable<String> rows = testLogger.statusText
.split('\n')
.map((String line) => line.trim())
- .where((String line) => line?.isNotEmpty == true)
+ .where((String line) => line.isNotEmpty == true)
.skip(1); // remove `Flutter channels:` line
expect(rows, <String>['beta', 'stable', 'Currently not on an official channel.']);
diff --git a/packages/flutter_tools/test/general.shard/cmake_test.dart b/packages/flutter_tools/test/general.shard/cmake_test.dart
index 1ef9bfc..3fe01ca 100644
--- a/packages/flutter_tools/test/general.shard/cmake_test.dart
+++ b/packages/flutter_tools/test/general.shard/cmake_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/base/file_system.dart';
@@ -17,11 +15,11 @@
const String _kTestWindowsFlutterRoot = r'C:\flutter';
void main() {
- FileSystem fileSystem;
-
- ProcessManager processManager;
+ late FileSystem fileSystem;
+ late ProcessManager processManager;
setUp(() {
+ processManager = FakeProcessManager.any();
fileSystem = MemoryFileSystem.test();
});
@@ -33,7 +31,7 @@
..createSync(recursive: true)
..writeAsStringSync('set(BINARY_NAME "hello")');
- final String name = getCmakeExecutableName(cmakeProject);
+ final String? name = getCmakeExecutableName(cmakeProject);
expect(name, 'hello');
}, overrides: <Type, Generator>{
@@ -45,7 +43,7 @@
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
final CmakeBasedProject cmakeProject = _FakeProject.fromFlutter(project);
- final String name = getCmakeExecutableName(cmakeProject);
+ final String? name = getCmakeExecutableName(cmakeProject);
expect(name, isNull);
}, overrides: <Type, Generator>{
diff --git a/packages/flutter_tools/test/general.shard/cold_test.dart b/packages/flutter_tools/test/general.shard/cold_test.dart
index cf19d3b..e2b71e0 100644
--- a/packages/flutter_tools/test/general.shard/cold_test.dart
+++ b/packages/flutter_tools/test/general.shard/cold_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart';
@@ -15,7 +13,6 @@
import 'package:flutter_tools/src/run_cold.dart';
import 'package:flutter_tools/src/tracing.dart';
import 'package:flutter_tools/src/vmservice.dart';
-import 'package:meta/meta.dart';
import 'package:test/fake.dart';
import 'package:vm_service/vm_service.dart';
@@ -68,8 +65,9 @@
});
group('cold run', () {
- MemoryFileSystem memoryFileSystem;
- FakePlatform fakePlatform;
+ late MemoryFileSystem memoryFileSystem;
+ late FakePlatform fakePlatform;
+
setUp(() {
memoryFileSystem = MemoryFileSystem();
fakePlatform = FakePlatform(environment: <String, String>{});
@@ -159,7 +157,7 @@
int runColdCode = 0;
@override
- Future<int> runCold({ColdRunner coldRunner, String route}) async {
+ Future<int> runCold({ColdRunner? coldRunner, String? route}) async {
return runColdCode;
}
@@ -175,10 +173,10 @@
bool isSupported() => true;
@override
- bool supportsHotReload;
+ bool supportsHotReload = false;
@override
- bool supportsHotRestart;
+ bool supportsHotRestart = false;
@override
Future<String> get sdkNameAndVersion async => 'Android 10';
@@ -199,9 +197,9 @@
class TestFlutterDevice extends FlutterDevice {
TestFlutterDevice({
- @required Device device,
- @required this.exception,
- @required ResidentCompiler generator,
+ required Device device,
+ required this.exception,
+ required ResidentCompiler generator,
}) : assert(exception != null),
super(device, buildInfo: BuildInfo.debug, generator: generator);
@@ -210,17 +208,17 @@
@override
Future<void> connect({
- ReloadSources reloadSources,
- Restart restart,
- CompileExpression compileExpression,
- GetSkSLMethod getSkSLMethod,
- PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
+ ReloadSources? reloadSources,
+ Restart? restart,
+ CompileExpression? compileExpression,
+ GetSkSLMethod? getSkSLMethod,
+ PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
bool enableDds = true,
bool cacheStartupProfile = false,
bool disableServiceAuthCodes = false,
- int hostVmServicePort,
- int ddsPort,
- bool ipv6 = false,
+ int? hostVmServicePort,
+ int? ddsPort,
+ bool? ipv6 = false,
bool allowExistingDdsInstance = false,
}) async {
throw exception;
@@ -239,10 +237,10 @@
}
@override
- Future<bool> flutterAlreadyPaintedFirstUsefulFrame({String isolateId}) async => true;
+ Future<bool> flutterAlreadyPaintedFirstUsefulFrame({String? isolateId}) async => true;
@override
- Future<Response> getTimeline() async {
+ Future<Response?> getTimeline() async {
return Response.parse(<String, dynamic>{
'traceEvents': <dynamic>[
<String, dynamic>{
diff --git a/packages/flutter_tools/test/general.shard/coverage_collector_test.dart b/packages/flutter_tools/test/general.shard/coverage_collector_test.dart
index e7d06d3..0e64618 100644
--- a/packages/flutter_tools/test/general.shard/coverage_collector_test.dart
+++ b/packages/flutter_tools/test/general.shard/coverage_collector_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:flutter_tools/src/test/coverage_collector.dart';
import 'package:vm_service/vm_service.dart';
@@ -20,11 +18,11 @@
),
FakeVmServiceRequest(
method: 'getVM',
- jsonResponse: (VM.parse(<String, Object>{})
+ jsonResponse: (VM.parse(<String, Object>{})!
..isolates = <IsolateRef>[
IsolateRef.parse(<String, Object>{
'id': '1',
- }),
+ })!,
]
).toJson(),
),
@@ -40,10 +38,10 @@
],
);
- final Map<String, Object> result = await collect(
+ final Map<String, Object?> result = await collect(
null,
<String>{'foo'},
- connector: (Uri uri) async {
+ connector: (Uri? uri) async {
return fakeVmServiceHost.vmService;
},
);
@@ -61,11 +59,11 @@
),
FakeVmServiceRequest(
method: 'getVM',
- jsonResponse: (VM.parse(<String, Object>{})
+ jsonResponse: (VM.parse(<String, Object>{})!
..isolates = <IsolateRef>[
IsolateRef.parse(<String, Object>{
'id': '1',
- }),
+ })!,
]
).toJson(),
),
@@ -112,10 +110,10 @@
],
);
- final Map<String, Object> result = await collect(
+ final Map<String, Object?> result = await collect(
null,
<String>{'foo'},
- connector: (Uri uri) async {
+ connector: (Uri? uri) async {
return fakeVmServiceHost.vmService;
},
);
@@ -148,11 +146,11 @@
),
FakeVmServiceRequest(
method: 'getVM',
- jsonResponse: (VM.parse(<String, Object>{})
+ jsonResponse: (VM.parse(<String, Object>{})!
..isolates = <IsolateRef>[
IsolateRef.parse(<String, Object>{
'id': '1',
- }),
+ })!,
]
).toJson(),
),
@@ -229,10 +227,10 @@
],
);
- final Map<String, Object> result = await collect(
+ final Map<String, Object?> result = await collect(
null,
null,
- connector: (Uri uri) async {
+ connector: (Uri? uri) async {
return fakeVmServiceHost.vmService;
},
);
@@ -276,11 +274,11 @@
),
FakeVmServiceRequest(
method: 'getVM',
- jsonResponse: (VM.parse(<String, Object>{})
+ jsonResponse: (VM.parse(<String, Object>{})!
..isolates = <IsolateRef>[
IsolateRef.parse(<String, Object>{
'id': '1',
- }),
+ })!,
]
).toJson(),
),
@@ -317,10 +315,10 @@
],
);
- final Map<String, Object> result = await collect(
+ final Map<String, Object?> result = await collect(
null,
<String>{'foo'},
- connector: (Uri uri) async {
+ connector: (Uri? uri) async {
return fakeVmServiceHost.vmService;
},
);
@@ -353,11 +351,11 @@
),
FakeVmServiceRequest(
method: 'getVM',
- jsonResponse: (VM.parse(<String, Object>{})
+ jsonResponse: (VM.parse(<String, Object>{})!
..isolates = <IsolateRef>[
IsolateRef.parse(<String, Object>{
'id': '1',
- }),
+ })!,
]
).toJson(),
),
@@ -393,10 +391,10 @@
],
);
- final Map<String, Object> result = await collect(
+ final Map<String, Object?> result = await collect(
null,
null,
- connector: (Uri uri) async {
+ connector: (Uri? uri) async {
return fakeVmServiceHost.vmService;
},
);
diff --git a/packages/flutter_tools/test/general.shard/create_config_test.dart b/packages/flutter_tools/test/general.shard/create_config_test.dart
index bb60690..1699de1 100644
--- a/packages/flutter_tools/test/general.shard/create_config_test.dart
+++ b/packages/flutter_tools/test/general.shard/create_config_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:flutter_tools/src/commands/create_base.dart';
import '../src/common.dart';
diff --git a/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart b/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart
index 34e550a..971eb9f 100644
--- a/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart
+++ b/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:async';
import 'package:file/file.dart';
@@ -116,9 +114,7 @@
final CustomDeviceConfig disabledTestConfig = testConfig.copyWith(enabled: false);
final CustomDeviceConfig testConfigNonForwarding = testConfig.copyWith(
explicitForwardPortCommand: true,
- forwardPortCommand: null,
explicitForwardPortSuccessRegex: true,
- forwardPortSuccessRegex: null,
);
testUsingContext('CustomDevice defaults',
@@ -339,12 +335,12 @@
final CustomDevicePortForwarder forwarder = CustomDevicePortForwarder(
deviceName: 'testdevicename',
- forwardPortCommand: testConfig.forwardPortCommand,
- forwardPortSuccessRegex: testConfig.forwardPortSuccessRegex,
+ forwardPortCommand: testConfig.forwardPortCommand!,
+ forwardPortSuccessRegex: testConfig.forwardPortSuccessRegex!,
logger: BufferLogger.test(),
processManager: FakeProcessManager.list(<FakeCommand>[
FakeCommand(
- command: testConfig.forwardPortCommand,
+ command: testConfig.forwardPortCommand!,
stdout: testConfigForwardPortSuccessOutput,
completer: forwardPortCommandCompleter,
),
@@ -373,7 +369,7 @@
stdout: 'The Dart VM service is listening on http://127.0.0.1:12345/abcd/\n',
),
FakeCommand(
- command: testConfig.forwardPortCommand,
+ command: testConfig.forwardPortCommand!,
completer: forwardPortCompleter,
stdout: testConfigForwardPortSuccessOutput,
),
@@ -450,7 +446,7 @@
command: testConfig.pingCommand,
stdout: testConfigPingSuccessOutput
),
- FakeCommand(command: testConfig.postBuildCommand),
+ FakeCommand(command: testConfig.postBuildCommand!),
FakeCommand(command: testConfig.uninstallCommand),
FakeCommand(command: testConfig.installCommand),
FakeCommand(
@@ -459,7 +455,7 @@
stdout: 'The Dart VM service is listening on http://127.0.0.1:12345/abcd/\n',
),
FakeCommand(
- command: testConfig.forwardPortCommand,
+ command: testConfig.forwardPortCommand!,
completer: forwardPortCompleter,
stdout: testConfigForwardPortSuccessOutput,
),
@@ -524,7 +520,7 @@
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(
- command: testConfig.screenshotCommand,
+ command: testConfig.screenshotCommand!,
onRun: () => screenshotCommandWasExecuted = true,
),
]);
@@ -550,7 +546,7 @@
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(
- command: testConfig.screenshotCommand,
+ command: testConfig.screenshotCommand!,
onRun: () => screenshotCommandWasExecuted = true,
),
]);
@@ -560,8 +556,7 @@
final CustomDevice device = CustomDevice(
config: testConfig.copyWith(
- explicitScreenshotCommand: true,
- screenshotCommand: null
+ explicitScreenshotCommand: true
),
logger: BufferLogger.test(),
processManager: processManager
@@ -640,14 +635,14 @@
class FakeBundleBuilder extends Fake implements BundleBuilder {
@override
Future<void> build({
- TargetPlatform platform,
- BuildInfo buildInfo,
- FlutterProject project,
- String mainPath,
+ TargetPlatform? platform,
+ BuildInfo? buildInfo,
+ FlutterProject? project,
+ String? mainPath,
String manifestPath = defaultManifestPath,
- String applicationKernelFilePath,
- String depfilePath,
- String assetDirPath,
- @visibleForTesting BuildSystem buildSystem
+ String? applicationKernelFilePath,
+ String? depfilePath,
+ String? assetDirPath,
+ @visibleForTesting BuildSystem? buildSystem
}) async {}
}
diff --git a/packages/flutter_tools/test/general.shard/dart_plugin_test.dart b/packages/flutter_tools/test/general.shard/dart_plugin_test.dart
index 74c1de2..a42d265 100644
--- a/packages/flutter_tools/test/general.shard/dart_plugin_test.dart
+++ b/packages/flutter_tools/test/general.shard/dart_plugin_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/dart/package_map.dart';
@@ -22,9 +20,9 @@
void main() {
group('Dart plugin registrant', () {
- FileSystem fs;
- FakeFlutterProject flutterProject;
- FakeFlutterManifest flutterManifest;
+ late FileSystem fs;
+ late FakeFlutterProject flutterProject;
+ late FakeFlutterManifest flutterManifest;
setUp(() async {
fs = MemoryFileSystem.test();
@@ -1023,35 +1021,35 @@
bool isModule = false;
@override
- FlutterManifest manifest;
+ late FlutterManifest manifest;
@override
- Directory directory;
+ late Directory directory;
@override
- File flutterPluginsFile;
+ late File flutterPluginsFile;
@override
- File flutterPluginsDependenciesFile;
+ late File flutterPluginsDependenciesFile;
@override
- File dartPluginRegistrant;
+ late File dartPluginRegistrant;
@override
- IosProject ios;
+ late IosProject ios;
@override
- AndroidProject android;
+ late AndroidProject android;
@override
- WebProject web;
+ late WebProject web;
@override
- MacOSProject macos;
+ late MacOSProject macos;
@override
- LinuxProject linux;
+ late LinuxProject linux;
@override
- WindowsProject windows;
+ late WindowsProject windows;
}
diff --git a/packages/flutter_tools/test/general.shard/devfs_test.dart b/packages/flutter_tools/test/general.shard/devfs_test.dart
index 9d1d240..e16c09f 100644
--- a/packages/flutter_tools/test/general.shard/devfs_test.dart
+++ b/packages/flutter_tools/test/general.shard/devfs_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:async';
import 'dart:convert';
import 'dart:io' as io show ProcessSignal, Process;
@@ -101,7 +99,6 @@
final DateTime fiveSecondsAgo = file.statSync().modified.subtract(const Duration(seconds: 5));
expect(content.isModifiedAfter(fiveSecondsAgo), isTrue);
expect(content.isModifiedAfter(fiveSecondsAgo), isTrue);
- expect(content.isModifiedAfter(null), isTrue);
file.writeAsBytesSync(<int>[2, 3, 4], flush: true);
@@ -186,7 +183,7 @@
requests: <VmServiceExpectation>[createDevFSRequest],
httpAddress: Uri.parse('http://localhost'),
);
- residentCompiler.onRecompile = (Uri mainUri, List<Uri> invalidatedFiles) async {
+ residentCompiler.onRecompile = (Uri mainUri, List<Uri>? invalidatedFiles) async {
fileSystem.file('lib/foo.dill')
..createSync(recursive: true)
..writeAsBytesSync(<int>[1, 2, 3, 4, 5]);
@@ -250,10 +247,10 @@
);
await devFS.create();
- final DateTime previousCompile = devFS.lastCompiled;
+ final DateTime? previousCompile = devFS.lastCompiled;
final FakeResidentCompiler residentCompiler = FakeResidentCompiler();
- residentCompiler.onRecompile = (Uri mainUri, List<Uri> invalidatedFiles) async {
+ residentCompiler.onRecompile = (Uri mainUri, List<Uri>? invalidatedFiles) async {
return const CompilerOutput('lib/foo.dill', 2, <Uri>[]);
};
@@ -289,10 +286,10 @@
);
await devFS.create();
- final DateTime previousCompile = devFS.lastCompiled;
+ final DateTime? previousCompile = devFS.lastCompiled;
final FakeResidentCompiler residentCompiler = FakeResidentCompiler();
- residentCompiler.onRecompile = (Uri mainUri, List<Uri> invalidatedFiles) async {
+ residentCompiler.onRecompile = (Uri mainUri, List<Uri>? invalidatedFiles) async {
fileSystem.file('lib/foo.txt.dill').createSync(recursive: true);
return const CompilerOutput('lib/foo.txt.dill', 0, <Uri>[]);
};
@@ -330,10 +327,10 @@
);
await devFS.create();
- final DateTime previousCompile = devFS.lastCompiled;
+ final DateTime? previousCompile = devFS.lastCompiled;
final FakeResidentCompiler residentCompiler = FakeResidentCompiler();
- residentCompiler.onRecompile = (Uri mainUri, List<Uri> invalidatedFiles) async {
+ residentCompiler.onRecompile = (Uri mainUri, List<Uri>? invalidatedFiles) async {
fileSystem.file('lib/foo.txt.dill').createSync(recursive: true);
return const CompilerOutput('lib/foo.txt.dill', 0, <Uri>[]);
};
@@ -380,7 +377,7 @@
await devFS.create();
final FakeResidentCompiler residentCompiler = FakeResidentCompiler();
- residentCompiler.onRecompile = (Uri mainUri, List<Uri> invalidatedFiles) async {
+ residentCompiler.onRecompile = (Uri mainUri, List<Uri>? invalidatedFiles) async {
fileSystem.file('example').createSync();
return const CompilerOutput('lib/foo.txt.dill', 0, <Uri>[]);
};
@@ -456,7 +453,7 @@
await devFS.create();
final FakeResidentCompiler residentCompiler = FakeResidentCompiler();
- residentCompiler.onRecompile = (Uri mainUri, List<Uri> invalidatedFiles) async {
+ residentCompiler.onRecompile = (Uri mainUri, List<Uri>? invalidatedFiles) async {
fileSystem.file('lib/foo.txt.dill').createSync(recursive: true);
return const CompilerOutput('lib/foo.txt.dill', 0, <Uri>[]);
};
@@ -506,7 +503,7 @@
await Future<dynamic>.delayed(const Duration(milliseconds: 5));
}
- String boundaryKey;
+ String? boundaryKey;
while(processed < frontendServerStdIn.writes.length) {
final List<int> data = frontendServerStdIn.writes[processed];
final String stringData = utf8.decode(data);
@@ -581,10 +578,10 @@
}
class FakeResidentCompiler extends Fake implements ResidentCompiler {
- Future<CompilerOutput> Function(Uri mainUri, List<Uri> invalidatedFiles) onRecompile;
+ Future<CompilerOutput> Function(Uri mainUri, List<Uri>? invalidatedFiles)? onRecompile;
@override
- Future<CompilerOutput> recompile(Uri mainUri, List<Uri> invalidatedFiles, {String outputPath, PackageConfig packageConfig, String projectRootPath, FileSystem fs, bool suppressErrors = false, bool checkDartPluginRegistry = false}) {
+ Future<CompilerOutput> recompile(Uri mainUri, List<Uri>? invalidatedFiles, {String? outputPath, PackageConfig? packageConfig, String? projectRootPath, FileSystem? fs, bool suppressErrors = false, bool checkDartPluginRegistry = false}) {
return onRecompile?.call(mainUri, invalidatedFiles)
?? Future<CompilerOutput>.value(const CompilerOutput('', 1, <Uri>[]));
}
@@ -605,12 +602,12 @@
List<String> messages = <String>[];
@override
- void printError(String message, {StackTrace stackTrace, bool emphasis, TerminalColor color, int indent, int hangingIndent, bool wrap}) {
+ void printError(String message, {StackTrace? stackTrace, bool? emphasis, TerminalColor? color, int? indent, int? hangingIndent, bool? wrap}) {
messages.add(message);
}
@override
- void printStatus(String message, {bool emphasis, TerminalColor color, bool newline, int indent, int hangingIndent, bool wrap}) {
+ void printStatus(String message, {bool? emphasis, TerminalColor? color, bool? newline, int? indent, int? hangingIndent, bool? wrap}) {
messages.add(message);
}
@@ -625,7 +622,7 @@
List<File> get additionalDependencies => <File>[];
@override
- Future<int> build({String manifestPath = defaultManifestPath, String assetDirPath, String packagesPath, bool deferredComponentsEnabled = false, TargetPlatform targetPlatform}) async {
+ Future<int> build({String manifestPath = defaultManifestPath, String? assetDirPath, String? packagesPath, bool deferredComponentsEnabled = false, TargetPlatform? targetPlatform}) async {
return 0;
}
@@ -657,7 +654,7 @@
final IOSink stdin;
@override
- bool canRun(dynamic executable, {String workingDirectory}) {
+ bool canRun(dynamic executable, {String? workingDirectory}) {
return true;
}
@@ -667,17 +664,17 @@
}
@override
- Future<ProcessResult> run(List<Object> command, {String workingDirectory, Map<String, String> environment, bool includeParentEnvironment = true, bool runInShell = false, Encoding stdoutEncoding = systemEncoding, Encoding stderrEncoding = systemEncoding}) async {
+ Future<ProcessResult> run(List<Object> command, {String? workingDirectory, Map<String, String>? environment, bool includeParentEnvironment = true, bool runInShell = false, Encoding? stdoutEncoding = systemEncoding, Encoding? stderrEncoding = systemEncoding}) async {
throw UnimplementedError();
}
@override
- ProcessResult runSync(List<Object> command, {String workingDirectory, Map<String, String> environment, bool includeParentEnvironment = true, bool runInShell = false, Encoding stdoutEncoding = systemEncoding, Encoding stderrEncoding = systemEncoding}) {
+ ProcessResult runSync(List<Object> command, {String? workingDirectory, Map<String, String>? environment, bool includeParentEnvironment = true, bool runInShell = false, Encoding? stdoutEncoding = systemEncoding, Encoding? stderrEncoding = systemEncoding}) {
throw UnimplementedError();
}
@override
- Future<Process> start(List<Object> command, {String workingDirectory, Map<String, String> environment, bool includeParentEnvironment = true, bool runInShell = false, ProcessStartMode mode = ProcessStartMode.normal}) async {
+ Future<Process> start(List<Object> command, {String? workingDirectory, Map<String, String>? environment, bool includeParentEnvironment = true, bool runInShell = false, ProcessStartMode mode = ProcessStartMode.normal}) async {
return AnsweringFakeProcess(stdout, stderr, stdin);
}
}
diff --git a/packages/flutter_tools/test/general.shard/devtools_launcher_test.dart b/packages/flutter_tools/test/general.shard/devtools_launcher_test.dart
index dfdfc3e..9477035 100644
--- a/packages/flutter_tools/test/general.shard/devtools_launcher_test.dart
+++ b/packages/flutter_tools/test/general.shard/devtools_launcher_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:async';
import 'package:flutter_tools/src/base/io.dart';
@@ -17,7 +15,7 @@
import '../src/fakes.dart';
void main() {
- BufferLogger logger;
+ late BufferLogger logger;
Cache.flutterRoot = '';
@@ -44,9 +42,9 @@
]),
);
- final DevToolsServerAddress address = await launcher.serve();
- expect(address.host, '127.0.0.1');
- expect(address.port, 9100);
+ final DevToolsServerAddress? address = await launcher.serve();
+ expect(address?.host, '127.0.0.1');
+ expect(address?.port, 9100);
});
testWithoutContext('DevtoolsLauncher does not launch a new DevTools instance if one is already active', () async {
@@ -68,14 +66,14 @@
]),
);
- DevToolsServerAddress address = await launcher.serve();
- expect(address.host, '127.0.0.1');
- expect(address.port, 9100);
+ DevToolsServerAddress? address = await launcher.serve();
+ expect(address?.host, '127.0.0.1');
+ expect(address?.port, 9100);
// Call `serve` again and verify that the already running server is returned.
address = await launcher.serve();
- expect(address.host, '127.0.0.1');
- expect(address.port, 9100);
+ expect(address?.host, '127.0.0.1');
+ expect(address?.port, 9100);
});
testWithoutContext('DevtoolsLauncher can launch devtools with a memory profile', () async {
diff --git a/packages/flutter_tools/test/general.shard/flutter_platform_test.dart b/packages/flutter_tools/test/general.shard/flutter_platform_test.dart
index b0a5674..6836233 100644
--- a/packages/flutter_tools/test/general.shard/flutter_platform_test.dart
+++ b/packages/flutter_tools/test/general.shard/flutter_platform_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart';
@@ -17,12 +15,11 @@
import '../src/context.dart';
void main() {
- FileSystem fileSystem;
+ late FileSystem fileSystem;
setUp(() {
fileSystem = MemoryFileSystem.test();
- fileSystem
- .file('.dart_tool/package_config.json')
+ fileSystem.file('.dart_tool/package_config.json')
..createSync(recursive: true)
..writeAsStringSync('{"configVersion":2,"packages":[]}');
});
@@ -80,7 +77,7 @@
),
), throwsAssertionError);
- FlutterPlatform capturedPlatform;
+ FlutterPlatform? capturedPlatform;
final Map<String, String> expectedPrecompiledDillFiles = <String, String>{'Key': 'Value'};
final FlutterPlatform flutterPlatform = installHook(
shellPath: 'abc',
diff --git a/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart b/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart
index 4527d9d..1b07356 100644
--- a/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart
+++ b/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:async';
import 'package:dds/dds.dart';
@@ -16,7 +14,6 @@
import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/test/flutter_tester_device.dart';
import 'package:flutter_tools/src/test/font_config_manager.dart';
-import 'package:meta/meta.dart';
import 'package:stream_channel/stream_channel.dart';
import 'package:test/fake.dart';
@@ -25,10 +22,10 @@
import '../src/fake_process_manager.dart';
void main() {
- FakePlatform platform;
- FileSystem fileSystem;
- FakeProcessManager processManager;
- FlutterTesterTestDevice device;
+ late FakePlatform platform;
+ late FileSystem fileSystem;
+ late FakeProcessManager processManager;
+ late FlutterTesterTestDevice device;
setUp(() {
fileSystem = MemoryFileSystem.test();
@@ -265,17 +262,14 @@
/// Uses a mock HttpServer. We don't want to bind random ports in our CI hosts.
class TestFlutterTesterDevice extends FlutterTesterTestDevice {
TestFlutterTesterDevice({
- @required Platform platform,
- @required FileSystem fileSystem,
- @required ProcessManager processManager,
- @required bool enableObservatory,
- @required List<String> dartEntrypointArgs,
+ required super.platform,
+ required super.fileSystem,
+ required super.processManager,
+ required super.enableObservatory,
+ required List<String> dartEntrypointArgs,
}) : super(
id: 999,
shellPath: '/',
- platform: platform,
- fileSystem: fileSystem,
- processManager: processManager,
logger: BufferLogger.test(),
debuggingOptions: DebuggingOptions.enabled(
const BuildInfo(
@@ -286,7 +280,6 @@
hostVmServicePort: 1234,
dartEntrypointArgs: dartEntrypointArgs,
),
- enableObservatory: enableObservatory,
machine: false,
host: InternetAddress.loopbackIPv6,
testAssetDirectory: null,
@@ -307,7 +300,7 @@
}
@override
- Future<HttpServer> bind(InternetAddress host, int port) async => FakeHttpServer();
+ Future<HttpServer> bind(InternetAddress? host, int port) async => FakeHttpServer();
@override
Future<StreamChannel<String>> get remoteChannel async => StreamChannelController<String>().foreign;
diff --git a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_pm_test.dart b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_pm_test.dart
index 834e023..2e00ce7 100644
--- a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_pm_test.dart
+++ b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_pm_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_pm.dart';
@@ -16,13 +14,12 @@
void main() {
group('FuchsiaPM', () {
- File pm;
- FakeProcessManager fakeProcessManager;
- FakeFuchsiaArtifacts fakeFuchsiaArtifacts;
+ late File pm;
+ late FakeProcessManager fakeProcessManager;
+ late FakeFuchsiaArtifacts fakeFuchsiaArtifacts;
setUp(() {
pm = MemoryFileSystem.test().file('pm');
-
fakeFuchsiaArtifacts = FakeFuchsiaArtifacts(pm);
fakeProcessManager = FakeProcessManager.empty();
});
diff --git a/packages/flutter_tools/test/general.shard/github_template_test.dart b/packages/flutter_tools/test/general.shard/github_template_test.dart
index fe33868..745bec9 100644
--- a/packages/flutter_tools/test/general.shard/github_template_test.dart
+++ b/packages/flutter_tools/test/general.shard/github_template_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/io.dart';
@@ -16,8 +14,9 @@
import '../src/context.dart';
void main() {
- BufferLogger logger;
- FileSystem fs;
+ late BufferLogger logger;
+ late FileSystem fs;
+
setUp(() {
logger = BufferLogger.test();
fs = MemoryFileSystem.test();
@@ -144,8 +143,8 @@
});
group('new issue template URL', () {
- StackTrace stackTrace;
- Error error;
+ late StackTrace stackTrace;
+ late Error error;
const String command = 'flutter test';
const String doctorText = ' [✓] Flutter (Channel report';
@@ -220,7 +219,7 @@
''');
final String actualURL = await creator.toolCrashIssueTemplateGitHubURL(command, error, stackTrace, doctorText);
- final String actualBody = Uri.parse(actualURL).queryParameters['body'];
+ final String? actualBody = Uri.parse(actualURL).queryParameters['body'];
const String expectedBody = '''
## Command
```
diff --git a/packages/flutter_tools/test/general.shard/integration_test_device_test.dart b/packages/flutter_tools/test/general.shard/integration_test_device_test.dart
index f886c5c..a612b35 100644
--- a/packages/flutter_tools/test/general.shard/integration_test_device_test.dart
+++ b/packages/flutter_tools/test/general.shard/integration_test_device_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/file.dart';
import 'package:flutter_tools/src/application_package.dart';
import 'package:flutter_tools/src/base/io.dart' as io;
@@ -64,8 +62,8 @@
final Uri observatoryUri = Uri.parse('http://localhost:1234');
void main() {
- FakeVmServiceHost fakeVmServiceHost;
- TestDevice testDevice;
+ late FakeVmServiceHost fakeVmServiceHost;
+ late TestDevice testDevice;
setUp(() {
testDevice = IntegrationTestTestDevice(
@@ -133,14 +131,14 @@
}, overrides: <Type, Generator>{
ApplicationPackageFactory: () => FakeApplicationPackageFactory(),
VMServiceConnector: () => (Uri httpUri, {
- ReloadSources reloadSources,
- Restart restart,
- CompileExpression compileExpression,
- GetSkSLMethod getSkSLMethod,
- PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
- io.CompressionOptions compression,
- Device device,
- Logger logger,
+ ReloadSources? reloadSources,
+ Restart? restart,
+ CompileExpression? compileExpression,
+ GetSkSLMethod? getSkSLMethod,
+ PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
+ io.CompressionOptions? compression,
+ Device? device,
+ Logger? logger,
}) async => fakeVmServiceHost.vmService,
});
@@ -152,14 +150,14 @@
}, overrides: <Type, Generator>{
ApplicationPackageFactory: () => FakeApplicationPackageFactory(),
VMServiceConnector: () => (Uri httpUri, {
- ReloadSources reloadSources,
- Restart restart,
- CompileExpression compileExpression,
- GetSkSLMethod getSkSLMethod,
- PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
- io.CompressionOptions compression,
- Device device,
- Logger logger,
+ ReloadSources? reloadSources,
+ Restart? restart,
+ CompileExpression? compileExpression,
+ GetSkSLMethod? getSkSLMethod,
+ PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
+ io.CompressionOptions? compression,
+ Device? device,
+ Logger? logger,
}) async => fakeVmServiceHost.vmService,
});
@@ -181,13 +179,13 @@
expect(() => testDevice.start('entrypointPath'), throwsA(isA<TestDeviceException>()));
}, overrides: <Type, Generator>{
VMServiceConnector: () => (Uri httpUri, {
- ReloadSources reloadSources,
- Restart restart,
- CompileExpression compileExpression,
- GetSkSLMethod getSkSLMethod,
- PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
- io.CompressionOptions compression,
- Device device,
+ ReloadSources? reloadSources,
+ Restart? restart,
+ CompileExpression? compileExpression,
+ GetSkSLMethod? getSkSLMethod,
+ PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
+ io.CompressionOptions? compression,
+ Device? device,
}) async => fakeVmServiceHost.vmService,
});
@@ -209,13 +207,13 @@
expect(() => testDevice.start('entrypointPath'), throwsA(isA<TestDeviceException>()));
}, overrides: <Type, Generator>{
VMServiceConnector: () => (Uri httpUri, {
- ReloadSources reloadSources,
- Restart restart,
- CompileExpression compileExpression,
- GetSkSLMethod getSkSLMethod,
- PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
- io.CompressionOptions compression,
- Device device,
+ ReloadSources? reloadSources,
+ Restart? restart,
+ CompileExpression? compileExpression,
+ GetSkSLMethod? getSkSLMethod,
+ PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
+ io.CompressionOptions? compression,
+ Device? device,
}) async => fakeVmServiceHost.vmService,
});
@@ -226,14 +224,14 @@
}, overrides: <Type, Generator>{
ApplicationPackageFactory: () => FakeApplicationPackageFactory(),
VMServiceConnector: () => (Uri httpUri, {
- ReloadSources reloadSources,
- Restart restart,
- CompileExpression compileExpression,
- GetSkSLMethod getSkSLMethod,
- PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
- io.CompressionOptions compression,
- Device device,
- Logger logger,
+ ReloadSources? reloadSources,
+ Restart? restart,
+ CompileExpression? compileExpression,
+ GetSkSLMethod? getSkSLMethod,
+ PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
+ io.CompressionOptions? compression,
+ Device? device,
+ Logger? logger,
}) async => fakeVmServiceHost.vmService,
});
}
@@ -242,8 +240,8 @@
@override
Future<ApplicationPackage> getPackageForPlatform(
TargetPlatform platform, {
- BuildInfo buildInfo,
- File applicationBinary,
+ BuildInfo? buildInfo,
+ File? applicationBinary,
}) async => FakeApplicationPackage();
}
diff --git a/packages/flutter_tools/test/general.shard/ios/ios_device_project_test.dart b/packages/flutter_tools/test/general.shard/ios/ios_device_project_test.dart
index 8712e70..15da88a 100644
--- a/packages/flutter_tools/test/general.shard/ios/ios_device_project_test.dart
+++ b/packages/flutter_tools/test/general.shard/ios/ios_device_project_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/file_system.dart';
@@ -22,7 +20,7 @@
// FlutterProject still depends on context.
void main() {
- FileSystem fileSystem;
+ late FileSystem fileSystem;
// This setup is required to inject the context.
setUp(() {
diff --git a/packages/flutter_tools/test/general.shard/ios/simulators_test.dart b/packages/flutter_tools/test/general.shard/ios/simulators_test.dart
index f943ce5..2177afa 100644
--- a/packages/flutter_tools/test/general.shard/ios/simulators_test.dart
+++ b/packages/flutter_tools/test/general.shard/ios/simulators_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart';
@@ -34,9 +32,9 @@
);
void main() {
- FakePlatform osx;
- FileSystemUtils fsUtils;
- MemoryFileSystem fileSystem;
+ late FakePlatform osx;
+ late FileSystemUtils fsUtils;
+ late MemoryFileSystem fileSystem;
setUp(() {
osx = FakePlatform(
@@ -48,8 +46,8 @@
});
group('_IOSSimulatorDevicePortForwarder', () {
- FakeSimControl simControl;
- Xcode xcode;
+ late FakeSimControl simControl;
+ late Xcode xcode;
setUp(() {
simControl = FakeSimControl();
@@ -100,7 +98,7 @@
});
group('logFilePath', () {
- FakeSimControl simControl;
+ late FakeSimControl simControl;
setUp(() {
simControl = FakeSimControl();
@@ -163,7 +161,7 @@
});
group('sdkMajorVersion', () {
- FakeSimControl simControl;
+ late FakeSimControl simControl;
setUp(() {
simControl = FakeSimControl();
@@ -205,7 +203,7 @@
});
group('IOSSimulator.isSupported', () {
- FakeSimControl simControl;
+ late FakeSimControl simControl;
setUp(() {
simControl = FakeSimControl();
@@ -368,8 +366,8 @@
});
group('device log tool', () {
- FakeProcessManager fakeProcessManager;
- FakeSimControl simControl;
+ late FakeProcessManager fakeProcessManager;
+ late FakeSimControl simControl;
setUp(() {
fakeProcessManager = FakeProcessManager.empty();
@@ -472,10 +470,10 @@
});
group('log reader', () {
- FakeProcessManager fakeProcessManager;
- FakeIosProject mockIosProject;
- FakeSimControl simControl;
- Xcode xcode;
+ late FakeProcessManager fakeProcessManager;
+ late FakeIosProject mockIosProject;
+ late FakeSimControl simControl;
+ late Xcode xcode;
setUp(() {
fakeProcessManager = FakeProcessManager.empty();
@@ -616,7 +614,7 @@
});
group('unified logging', () {
- BufferLogger logger;
+ late BufferLogger logger;
setUp(() {
logger = BufferLogger.test();
@@ -754,9 +752,9 @@
}
''';
- FakeProcessManager fakeProcessManager;
+ late FakeProcessManager fakeProcessManager;
Xcode xcode;
- SimControl simControl;
+ late SimControl simControl;
const String deviceId = 'smart-phone';
const String appId = 'flutterApp';
@@ -895,10 +893,10 @@
});
group('startApp', () {
- FakePlistParser testPlistParser;
- FakeSimControl simControl;
- Xcode xcode;
- BufferLogger logger;
+ late FakePlistParser testPlistParser;
+ late FakeSimControl simControl;
+ late Xcode xcode;
+ late BufferLogger logger;
setUp(() {
simControl = FakeSimControl();
@@ -1027,8 +1025,8 @@
});
group('IOSDevice.isSupportedForProject', () {
- FakeSimControl simControl;
- Xcode xcode;
+ late FakeSimControl simControl;
+ late Xcode xcode;
setUp(() {
simControl = FakeSimControl();
@@ -1113,17 +1111,17 @@
class FakeIosProject extends Fake implements IosProject {
@override
- Future<String> productBundleIdentifier(BuildInfo buildInfo) async => 'com.example.test';
+ Future<String> productBundleIdentifier(BuildInfo? buildInfo) async => 'com.example.test';
@override
- Future<String> hostAppBundleName(BuildInfo buildInfo) async => 'My Super Awesome App.app';
+ Future<String> hostAppBundleName(BuildInfo? buildInfo) async => 'My Super Awesome App.app';
}
class FakeSimControl extends Fake implements SimControl {
final List<LaunchRequest> requests = <LaunchRequest>[];
@override
- Future<RunResult> launch(String deviceId, String appIdentifier, [ List<String> launchArgs ]) async {
+ Future<RunResult> launch(String deviceId, String appIdentifier, [ List<String>? launchArgs ]) async {
requests.add(LaunchRequest(deviceId, appIdentifier, launchArgs));
return RunResult(ProcessResult(0, 0, '', ''), <String>['test']);
}
@@ -1139,5 +1137,5 @@
final String deviceId;
final String appIdentifier;
- final List<String> launchArgs;
+ final List<String>? launchArgs;
}
diff --git a/packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart b/packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart
index 9b2a0d2..de49668 100644
--- a/packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart
+++ b/packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/file_system.dart';
@@ -56,11 +54,11 @@
stdout: 'hw.optional.arm64: 1',
);
- FakeProcessManager fakeProcessManager;
- XcodeProjectInterpreter xcodeProjectInterpreter;
- FakePlatform platform;
- FileSystem fileSystem;
- BufferLogger logger;
+ late FakeProcessManager fakeProcessManager;
+ late XcodeProjectInterpreter xcodeProjectInterpreter;
+ late FakePlatform platform;
+ late FileSystem fileSystem;
+ late BufferLogger logger;
setUp(() {
fakeProcessManager = FakeProcessManager.empty();
@@ -660,7 +658,7 @@
expect(info.buildConfigurationFor(const BuildInfo(BuildMode.release, 'Paid', treeShakeIcons: false), 'Paid'), null);
});
group('environmentVariablesAsXcodeBuildSettings', () {
- FakePlatform platform;
+ late FakePlatform platform;
setUp(() {
platform = FakePlatform();
@@ -679,9 +677,9 @@
});
group('updateGeneratedXcodeProperties', () {
- Artifacts localIosArtifacts;
- FakePlatform macOS;
- FileSystem fs;
+ late Artifacts localIosArtifacts;
+ late FakePlatform macOS;
+ late FileSystem fs;
setUp(() {
fs = MemoryFileSystem.test();
@@ -691,8 +689,8 @@
});
group('arm simulator', () {
- FakeProcessManager fakeProcessManager;
- XcodeProjectInterpreter xcodeProjectInterpreter;
+ late FakeProcessManager fakeProcessManager;
+ late XcodeProjectInterpreter xcodeProjectInterpreter;
setUp(() {
fakeProcessManager = FakeProcessManager.empty();
@@ -1047,7 +1045,7 @@
});
});
- String propertyFor(String key, File file) {
+ String? propertyFor(String key, File file) {
final List<String> properties = file
.readAsLinesSync()
.where((String line) => line.startsWith('$key='))
@@ -1057,10 +1055,10 @@
}
Future<void> checkBuildVersion({
- String manifestString,
- BuildInfo buildInfo,
- String expectedBuildName,
- String expectedBuildNumber,
+ required String manifestString,
+ required BuildInfo buildInfo,
+ String? expectedBuildName,
+ String? expectedBuildNumber,
}) async {
final File manifestFile = fs.file('path/to/project/pubspec.yaml');
manifestFile.createSync(recursive: true);
diff --git a/packages/flutter_tools/test/general.shard/macos/application_package_test.dart b/packages/flutter_tools/test/general.shard/macos/application_package_test.dart
index 490f216..57e11ff 100644
--- a/packages/flutter_tools/test/general.shard/macos/application_package_test.dart
+++ b/packages/flutter_tools/test/general.shard/macos/application_package_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:convert';
import 'package:file/file.dart';
@@ -23,9 +21,9 @@
void main() {
group('PrebuiltMacOSApp', () {
- FakeOperatingSystemUtils os;
- FileSystem fileSystem;
- BufferLogger logger;
+ late FakeOperatingSystemUtils os;
+ late FileSystem fileSystem;
+ late BufferLogger logger;
final Map<Type, Generator> overrides = <Type, Generator>{
FileSystem: () => fileSystem,
@@ -42,7 +40,7 @@
});
testUsingContext('Error on non-existing file', () {
- final PrebuiltMacOSApp macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('not_existing.app')) as PrebuiltMacOSApp;
+ final PrebuiltMacOSApp? macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('not_existing.app')) as PrebuiltMacOSApp?;
expect(macosApp, isNull);
expect(logger.errorText, contains('File "not_existing.app" does not exist.'));
@@ -50,7 +48,7 @@
testUsingContext('Error on non-app-bundle folder', () {
fileSystem.directory('regular_folder').createSync();
- final PrebuiltMacOSApp macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('regular_folder')) as PrebuiltMacOSApp;
+ final PrebuiltMacOSApp? macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('regular_folder')) as PrebuiltMacOSApp?;
expect(macosApp, isNull);
expect(logger.errorText, contains('Folder "regular_folder" is not an app bundle.'));
@@ -58,7 +56,7 @@
testUsingContext('Error on no info.plist', () {
fileSystem.directory('bundle.app').createSync();
- final PrebuiltMacOSApp macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('bundle.app')) as PrebuiltMacOSApp;
+ final PrebuiltMacOSApp? macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('bundle.app')) as PrebuiltMacOSApp?;
expect(macosApp, isNull);
expect(logger.errorText, contains('Invalid prebuilt macOS app. Does not contain Info.plist.'));
@@ -67,10 +65,9 @@
testUsingContext('Error on info.plist missing bundle identifier', () {
final String contentsDirectory = fileSystem.path.join('bundle.app', 'Contents');
fileSystem.directory(contentsDirectory).createSync(recursive: true);
- fileSystem
- .file(fileSystem.path.join('bundle.app', 'Contents', 'Info.plist'))
+ fileSystem.file(fileSystem.path.join('bundle.app', 'Contents', 'Info.plist'))
.writeAsStringSync(badPlistData);
- final PrebuiltMacOSApp macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('bundle.app')) as PrebuiltMacOSApp;
+ final PrebuiltMacOSApp? macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('bundle.app')) as PrebuiltMacOSApp?;
expect(macosApp, isNull);
expect(logger.errorText, contains('Invalid prebuilt macOS app. Info.plist does not contain bundle identifier'));
@@ -79,10 +76,9 @@
testUsingContext('Error on info.plist missing executable', () {
final String contentsDirectory = fileSystem.path.join('bundle.app', 'Contents');
fileSystem.directory(contentsDirectory).createSync(recursive: true);
- fileSystem
- .file(fileSystem.path.join('bundle.app', 'Contents', 'Info.plist'))
+ fileSystem.file(fileSystem.path.join('bundle.app', 'Contents', 'Info.plist'))
.writeAsStringSync(badPlistDataNoExecutable);
- final PrebuiltMacOSApp macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('bundle.app')) as PrebuiltMacOSApp;
+ final PrebuiltMacOSApp? macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('bundle.app')) as PrebuiltMacOSApp?;
expect(macosApp, isNull);
expect(logger.errorText, contains('Invalid prebuilt macOS app. Info.plist does not contain bundle executable'));
@@ -91,13 +87,11 @@
testUsingContext('Success with app bundle', () {
final String appDirectory = fileSystem.path.join('bundle.app', 'Contents', 'MacOS');
fileSystem.directory(appDirectory).createSync(recursive: true);
- fileSystem
- .file(fileSystem.path.join('bundle.app', 'Contents', 'Info.plist'))
+ fileSystem.file(fileSystem.path.join('bundle.app', 'Contents', 'Info.plist'))
.writeAsStringSync(plistData);
- fileSystem
- .file(fileSystem.path.join(appDirectory, executableName))
+ fileSystem.file(fileSystem.path.join(appDirectory, executableName))
.createSync();
- final PrebuiltMacOSApp macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('bundle.app')) as PrebuiltMacOSApp;
+ final PrebuiltMacOSApp macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('bundle.app'))! as PrebuiltMacOSApp;
expect(logger.errorText, isEmpty);
expect(macosApp.uncompressedBundle.path, 'bundle.app');
@@ -107,7 +101,7 @@
testUsingContext('Bad zipped app, no payload dir', () {
fileSystem.file('app.zip').createSync();
- final PrebuiltMacOSApp macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('app.zip')) as PrebuiltMacOSApp;
+ final PrebuiltMacOSApp? macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('app.zip')) as PrebuiltMacOSApp?;
expect(macosApp, isNull);
expect(logger.errorText, contains('Archive "app.zip" does not contain a single app bundle.'));
@@ -124,7 +118,7 @@
fileSystem.directory(bundlePath1).createSync(recursive: true);
fileSystem.directory(bundlePath2).createSync(recursive: true);
};
- final PrebuiltMacOSApp macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('app.zip')) as PrebuiltMacOSApp;
+ final PrebuiltMacOSApp? macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('app.zip')) as PrebuiltMacOSApp?;
expect(macosApp, isNull);
expect(logger.errorText, contains('Archive "app.zip" does not contain a single app bundle.'));
@@ -138,18 +132,15 @@
}
final Directory bundleAppContentsDir = fileSystem.directory(fileSystem.path.join(targetDirectory.path, 'bundle.app', 'Contents'));
bundleAppContentsDir.createSync(recursive: true);
- fileSystem
- .file(fileSystem.path.join(bundleAppContentsDir.path, 'Info.plist'))
+ fileSystem.file(fileSystem.path.join(bundleAppContentsDir.path, 'Info.plist'))
.writeAsStringSync(plistData);
- fileSystem
- .directory(fileSystem.path.join(bundleAppContentsDir.path, 'MacOS'))
+ fileSystem.directory(fileSystem.path.join(bundleAppContentsDir.path, 'MacOS'))
.createSync();
- fileSystem
- .file(fileSystem.path
+ fileSystem.file(fileSystem.path
.join(bundleAppContentsDir.path, 'MacOS', executableName))
.createSync();
};
- final PrebuiltMacOSApp macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('app.zip')) as PrebuiltMacOSApp;
+ final PrebuiltMacOSApp macosApp = MacOSApp.fromPrebuiltApp(fileSystem.file('app.zip'))! as PrebuiltMacOSApp;
expect(logger.errorText, isEmpty);
expect(macosApp.uncompressedBundle.path, endsWith('bundle.app'));
@@ -170,7 +161,7 @@
class FakeOperatingSystemUtils extends Fake implements OperatingSystemUtils {
FakeOperatingSystemUtils();
- void Function(File, Directory) unzipOverride;
+ void Function(File, Directory)? unzipOverride;
@override
void unzip(File file, Directory targetDirectory) {
@@ -181,15 +172,15 @@
class FakePlistUtils extends Fake implements PlistParser {
FakePlistUtils(this.fileSystem);
- final FileSystem fileSystem;
+ final FileSystem? fileSystem;
@override
- Map<String, dynamic> parseFile(String plistFilePath) {
- final File file = fileSystem.file(plistFilePath);
+ Map<String, Object> parseFile(String plistFilePath) {
+ final File file = fileSystem!.file(plistFilePath);
if (!file.existsSync()) {
- return <String, dynamic>{};
+ return <String, Object>{};
}
- return castStringKeyedMap(json.decode(file.readAsStringSync()));
+ return castStringKeyedMap(json.decode(file.readAsStringSync()))!.cast();
}
}
diff --git a/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart b/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart
index 1f2b90c..3c34f14 100644
--- a/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart
+++ b/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/logger.dart';
@@ -22,11 +20,11 @@
import '../../src/fake_process_manager.dart';
void main() {
- FileSystem fileSystem;
- FakeProcessManager fakeProcessManager;
- CocoaPods cocoaPodsUnderTest;
- BufferLogger logger;
- TestUsage usage;
+ late FileSystem fileSystem;
+ late FakeProcessManager fakeProcessManager;
+ late CocoaPods cocoaPodsUnderTest;
+ late BufferLogger logger;
+ late TestUsage usage;
void pretendPodVersionFails() {
fakeProcessManager.addCommand(
@@ -77,17 +75,17 @@
usage: usage,
);
fileSystem.file(fileSystem.path.join(
- Cache.flutterRoot, 'packages', 'flutter_tools', 'templates', 'cocoapods', 'Podfile-ios-objc',
+ Cache.flutterRoot!, 'packages', 'flutter_tools', 'templates', 'cocoapods', 'Podfile-ios-objc',
))
..createSync(recursive: true)
..writeAsStringSync('Objective-C iOS podfile template');
fileSystem.file(fileSystem.path.join(
- Cache.flutterRoot, 'packages', 'flutter_tools', 'templates', 'cocoapods', 'Podfile-ios-swift',
+ Cache.flutterRoot!, 'packages', 'flutter_tools', 'templates', 'cocoapods', 'Podfile-ios-swift',
))
..createSync(recursive: true)
..writeAsStringSync('Swift iOS podfile template');
fileSystem.file(fileSystem.path.join(
- Cache.flutterRoot, 'packages', 'flutter_tools', 'templates', 'cocoapods', 'Podfile-macos',
+ Cache.flutterRoot!, 'packages', 'flutter_tools', 'templates', 'cocoapods', 'Podfile-macos',
))
..createSync(recursive: true)
..writeAsStringSync('macOS podfile template');
@@ -728,7 +726,6 @@
final bool didInstall = await cocoaPodsUnderTest.processPods(
xcodeProject: projectUnderTest.ios,
buildMode: BuildMode.debug,
- dependenciesChanged: true,
);
expect(didInstall, isTrue);
expect(fakeProcessManager, hasNoRemainingExpectations);
@@ -828,7 +825,7 @@
@override
Future<Map<String, String>> getBuildSettings(
String projectPath, {
- XcodeProjectBuildContext buildContext,
+ XcodeProjectBuildContext? buildContext,
Duration timeout = const Duration(minutes: 1),
}) async => buildSettings;
diff --git a/packages/flutter_tools/test/general.shard/macos/xcode_test.dart b/packages/flutter_tools/test/general.shard/macos/xcode_test.dart
index ed7a5d7..3969151 100644
--- a/packages/flutter_tools/test/general.shard/macos/xcode_test.dart
+++ b/packages/flutter_tools/test/general.shard/macos/xcode_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:async';
import 'package:flutter_tools/src/artifacts.dart';
@@ -24,21 +22,21 @@
import '../../src/context.dart';
void main() {
- BufferLogger logger;
+ late BufferLogger logger;
setUp(() {
logger = BufferLogger.test();
});
group('FakeProcessManager', () {
- FakeProcessManager fakeProcessManager;
+ late FakeProcessManager fakeProcessManager;
setUp(() {
fakeProcessManager = FakeProcessManager.empty();
});
group('Xcode', () {
- FakeXcodeProjectInterpreter xcodeProjectInterpreter;
+ late FakeXcodeProjectInterpreter xcodeProjectInterpreter;
setUp(() {
xcodeProjectInterpreter = FakeXcodeProjectInterpreter();
@@ -94,7 +92,7 @@
});
group('macOS', () {
- Xcode xcode;
+ late Xcode xcode;
setUp(() {
xcodeProjectInterpreter = FakeXcodeProjectInterpreter();
@@ -276,8 +274,8 @@
});
group('xcdevice not installed', () {
- XCDevice xcdevice;
- Xcode xcode;
+ late XCDevice xcdevice;
+ late Xcode xcode;
setUp(() {
xcode = Xcode.test(
@@ -310,8 +308,8 @@
});
group('xcdevice', () {
- XCDevice xcdevice;
- Xcode xcode;
+ late XCDevice xcdevice;
+ late Xcode xcode;
setUp(() {
xcode = Xcode.test(processManager: FakeProcessManager.any());
@@ -351,7 +349,7 @@
// Attach: d83d5bc53967baa0ee18626ba87b6254b2ab5418
// Attach: 00008027-00192736010F802E
// Detach: d83d5bc53967baa0ee18626ba87b6254b2ab5418
- xcdevice.observedDeviceEvents().listen((Map<XCDeviceEvent, String> event) {
+ xcdevice.observedDeviceEvents()!.listen((Map<XCDeviceEvent, String> event) {
expect(event.length, 1);
if (event.containsKey(XCDeviceEvent.attach)) {
if (event[XCDeviceEvent.attach] == 'd83d5bc53967baa0ee18626ba87b6254b2ab5418') {
diff --git a/packages/flutter_tools/test/general.shard/plugins_test.dart b/packages/flutter_tools/test/general.shard/plugins_test.dart
index d724dd6..71c5fb2 100644
--- a/packages/flutter_tools/test/general.shard/plugins_test.dart
+++ b/packages/flutter_tools/test/general.shard/plugins_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:convert';
import 'package:file/file.dart';
@@ -21,7 +19,6 @@
import 'package:flutter_tools/src/plugins.dart';
import 'package:flutter_tools/src/project.dart';
import 'package:flutter_tools/src/version.dart';
-import 'package:meta/meta.dart';
import 'package:test/fake.dart';
import 'package:yaml/yaml.dart';
@@ -42,16 +39,16 @@
assert(androidPackage == null || pluginClass != null);
/// The pluginClass entry, if any.
- final String pluginClass;
+ final String? pluginClass;
/// The dartPluginClass entry, if any.
- final String dartPluginClass;
+ final String? dartPluginClass;
/// The package entry for an Android plugin implementation using pluginClass.
- final String androidPackage;
+ final String? androidPackage;
/// The fileName entry for a web plugin implementation.
- final String fileName;
+ final String? fileName;
/// Returns the body of a platform section for a plugin's pubspec, properly
/// indented.
@@ -72,21 +69,21 @@
void main() {
group('plugins', () {
- FileSystem fs;
- FakeFlutterProject flutterProject;
- FakeFlutterManifest flutterManifest;
- FakeIosProject iosProject;
- FakeMacOSProject macosProject;
- FakeAndroidProject androidProject;
- FakeWebProject webProject;
- FakeWindowsProject windowsProject;
- FakeLinuxProject linuxProject;
- FakeSystemClock systemClock;
- FlutterVersion flutterVersion;
+ late FileSystem fs;
+ late FakeFlutterProject flutterProject;
+ late FakeFlutterManifest flutterManifest;
+ late FakeIosProject iosProject;
+ late FakeMacOSProject macosProject;
+ late FakeAndroidProject androidProject;
+ late FakeWebProject webProject;
+ late FakeWindowsProject windowsProject;
+ late FakeLinuxProject linuxProject;
+ late FakeSystemClock systemClock;
+ late FlutterVersion flutterVersion;
// A Windows-style filesystem. This is not populated by default, so tests
// using it instead of fs must re-run any necessary setup (e.g.,
// setUpProject).
- FileSystem fsWindows;
+ late FileSystem fsWindows;
// Adds basic properties to the flutterProject and its subprojects.
void setUpProject(FileSystem fileSystem) {
@@ -372,8 +369,8 @@
}
Directory createLegacyPluginWithDependencies({
- @required String name,
- @required List<String> dependencies,
+ required String name,
+ required List<String> dependencies,
}) {
assert(name != null);
assert(dependencies != null);
@@ -404,8 +401,8 @@
}
Directory createPlugin({
- @required String name,
- @required Map<String, _PluginPlatformInfo> platforms,
+ required String name,
+ required Map<String, _PluginPlatformInfo> platforms,
List<String> dependencies = const <String>[],
}) {
assert(name != null);
@@ -619,15 +616,15 @@
expect(flutterProject.flutterPluginsDependenciesFile.existsSync(), true);
final String pluginsString = flutterProject.flutterPluginsDependenciesFile.readAsStringSync();
final Map<String, dynamic> jsonContent = json.decode(pluginsString) as Map<String, dynamic>;
- final Map<String, dynamic> plugins = jsonContent['plugins'] as Map<String, dynamic>;
+ final Map<String, dynamic>? plugins = jsonContent['plugins'] as Map<String, dynamic>?;
// Extracts the native_build key (if any) from the first plugin for the
// given platform.
- bool getNativeBuildValue(String platform) {
- final List<Map<String, dynamic>> platformPlugins = (plugins[platform]
+ bool? getNativeBuildValue(String platform) {
+ final List<Map<String, dynamic>> platformPlugins = (plugins![platform]
as List<dynamic>).cast<Map<String, dynamic>>();
expect(platformPlugins.length, 1);
- return platformPlugins[0]['native_build'] as bool;
+ return platformPlugins[0]['native_build'] as bool?;
}
expect(getNativeBuildValue('android'), true);
expect(getNativeBuildValue('ios'), true);
@@ -682,7 +679,7 @@
});
group('injectPlugins', () {
- FakeXcodeProjectInterpreter xcodeProjectInterpreter;
+ FakeXcodeProjectInterpreter? xcodeProjectInterpreter;
setUp(() {
xcodeProjectInterpreter = FakeXcodeProjectInterpreter();
@@ -1402,8 +1399,8 @@
await injectPlugins(flutterProject, linuxPlatform: true, windowsPlatform: true);
- for (final CmakeBasedProject project in <CmakeBasedProject>[linuxProject, windowsProject]) {
- final File pluginCmakefile = project.generatedPluginCmakeFile;
+ for (final CmakeBasedProject? project in <CmakeBasedProject?>[linuxProject, windowsProject]) {
+ final File pluginCmakefile = project!.generatedPluginCmakeFile;
expect(pluginCmakefile.existsSync(), isTrue);
final String contents = pluginCmakefile.readAsStringSync();
@@ -1416,7 +1413,7 @@
});
group('createPluginSymlinks', () {
- FeatureFlags featureFlags;
+ FeatureFlags? featureFlags;
setUp(() {
featureFlags = TestFeatureFlags(isLinuxEnabled: true, isWindowsEnabled: true);
@@ -1546,8 +1543,8 @@
});
group('pubspec', () {
- Directory projectDir;
- Directory tempDir;
+ late Directory projectDir;
+ late Directory tempDir;
setUp(() {
tempDir = globals.fs.systemTempDirectory.createTempSync('flutter_plugin_test.');
@@ -1603,7 +1600,7 @@
});
testUsingContext('createPlatformsYamlMap should create empty map', () async {
- final YamlMap map = Plugin.createPlatformsYamlMap(<String>[], null, null);
+ final YamlMap map = Plugin.createPlatformsYamlMap(<String>[], 'foo', 'bar');
expect(map.isEmpty, true);
});
@@ -1655,34 +1652,34 @@
bool isModule = false;
@override
- FlutterManifest manifest;
+ late FlutterManifest manifest;
@override
- Directory directory;
+ late Directory directory;
@override
- File flutterPluginsFile;
+ late File flutterPluginsFile;
@override
- File flutterPluginsDependenciesFile;
+ late File flutterPluginsDependenciesFile;
@override
- IosProject ios;
+ late IosProject ios;
@override
- AndroidProject android;
+ late AndroidProject android;
@override
- WebProject web;
+ late WebProject web;
@override
- MacOSProject macos;
+ late MacOSProject macos;
@override
- LinuxProject linux;
+ late LinuxProject linux;
@override
- WindowsProject windows;
+ late WindowsProject windows;
}
class FakeMacOSProject extends Fake implements MacOSProject {
@@ -1692,13 +1689,13 @@
bool exists = false;
@override
- File podfile;
+ late File podfile;
@override
- File podManifestLock;
+ late File podManifestLock;
@override
- Directory managedDirectory;
+ late Directory managedDirectory;
@override
bool existsSync() => exists;
@@ -1717,7 +1714,7 @@
bool get exists => testExists;
@override
- Directory pluginRegistrantHost;
+ late Directory pluginRegistrantHost;
@override
File get pluginRegistrantHeader => pluginRegistrantHost.childFile('GeneratedPluginRegistrant.h');
@@ -1726,10 +1723,10 @@
File get pluginRegistrantImplementation => pluginRegistrantHost.childFile('GeneratedPluginRegistrant.m');
@override
- File podfile;
+ late File podfile;
@override
- File podManifestLock;
+ late File podManifestLock;
}
class FakeAndroidProject extends Fake implements AndroidProject {
@@ -1739,15 +1736,15 @@
bool exists = false;
@override
- Directory pluginRegistrantHost;
+ late Directory pluginRegistrantHost;
@override
- Directory hostAppGradleRoot;
+ late Directory hostAppGradleRoot;
@override
- File appManifestFile;
+ late File appManifestFile;
- AndroidEmbeddingVersion embeddingVersion;
+ late AndroidEmbeddingVersion embeddingVersion;
@override
bool existsSync() => exists;
@@ -1768,7 +1765,7 @@
String pluginConfigKey = 'web';
@override
- Directory libDirectory;
+ late Directory libDirectory;
bool exists = false;
@@ -1781,19 +1778,19 @@
String pluginConfigKey = 'windows';
@override
- Directory managedDirectory;
+ late Directory managedDirectory;
@override
- Directory ephemeralDirectory;
+ late Directory ephemeralDirectory;
@override
- Directory pluginSymlinkDirectory;
+ late Directory pluginSymlinkDirectory;
@override
- File cmakeFile;
+ late File cmakeFile;
@override
- File generatedPluginCmakeFile;
+ late File generatedPluginCmakeFile;
bool exists = false;
@override
@@ -1805,19 +1802,19 @@
String pluginConfigKey = 'linux';
@override
- Directory managedDirectory;
+ late Directory managedDirectory;
@override
- Directory ephemeralDirectory;
+ late Directory ephemeralDirectory;
@override
- Directory pluginSymlinkDirectory;
+ late Directory pluginSymlinkDirectory;
@override
- File cmakeFile;
+ late File cmakeFile;
@override
- File generatedPluginCmakeFile;
+ late File generatedPluginCmakeFile;
bool exists = false;
@override
@@ -1833,7 +1830,7 @@
}
class FakeSystemClock extends Fake implements SystemClock {
- DateTime currentTime;
+ late DateTime currentTime;
@override
DateTime now() {
diff --git a/packages/flutter_tools/test/general.shard/preview_device_test.dart b/packages/flutter_tools/test/general.shard/preview_device_test.dart
index 440d6e2..f1f4426 100644
--- a/packages/flutter_tools/test/general.shard/preview_device_test.dart
+++ b/packages/flutter_tools/test/general.shard/preview_device_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:async';
import 'package:file/memory.dart';
@@ -93,15 +91,15 @@
@override
Future<void> build({
- @required TargetPlatform platform,
- @required BuildInfo buildInfo,
- FlutterProject project,
- String mainPath,
+ required TargetPlatform platform,
+ required BuildInfo buildInfo,
+ FlutterProject? project,
+ String? mainPath,
String manifestPath = defaultManifestPath,
- String applicationKernelFilePath,
- String depfilePath,
- String assetDirPath,
- @visibleForTesting BuildSystem buildSystem
+ String? applicationKernelFilePath,
+ String? depfilePath,
+ String? assetDirPath,
+ @visibleForTesting BuildSystem? buildSystem
}) async {
final Directory assetDirectory = fileSystem
.directory(assetDirPath)
diff --git a/packages/flutter_tools/test/general.shard/project_file_invalidator_test.dart b/packages/flutter_tools/test/general.shard/project_file_invalidator_test.dart
index 685c550..35c12ca 100644
--- a/packages/flutter_tools/test/general.shard/project_file_invalidator_test.dart
+++ b/packages/flutter_tools/test/general.shard/project_file_invalidator_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/logger.dart';
diff --git a/packages/flutter_tools/test/general.shard/resident_devtools_handler_test.dart b/packages/flutter_tools/test/general.shard/resident_devtools_handler_test.dart
index ddadcab..d6c595c 100644
--- a/packages/flutter_tools/test/general.shard/resident_devtools_handler_test.dart
+++ b/packages/flutter_tools/test/general.shard/resident_devtools_handler_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:async';
import 'package:flutter_tools/src/base/logger.dart';
@@ -107,8 +105,8 @@
flutterDevices: <FlutterDevice>[],
);
- expect(handler.activeDevToolsServer.host, 'localhost');
- expect(handler.activeDevToolsServer.port, 8181);
+ expect(handler.activeDevToolsServer!.host, 'localhost');
+ expect(handler.activeDevToolsServer!.port, 8181);
});
testWithoutContext('serveAndAnnounceDevTools with attached device does not fail on null vm service', () async {
@@ -425,13 +423,13 @@
class FakeDevtoolsLauncher extends Fake implements DevtoolsLauncher {
@override
- DevToolsServerAddress activeDevToolsServer;
+ DevToolsServerAddress? activeDevToolsServer;
@override
- Uri devToolsUrl;
+ Uri? devToolsUrl;
@override
- Future<DevToolsServerAddress> serve() async => null;
+ Future<DevToolsServerAddress?> serve() async => null;
@override
Future<void> get ready => readyCompleter.future;
@@ -452,7 +450,7 @@
final Device device = FakeDevice();
@override
- FlutterVmService vmService;
+ FlutterVmService? vmService;
@override
TargetPlatform targetPlatform = TargetPlatform.android_arm;
diff --git a/packages/flutter_tools/test/general.shard/terminal_handler_test.dart b/packages/flutter_tools/test/general.shard/terminal_handler_test.dart
index e9af1ef..94291fc 100644
--- a/packages/flutter_tools/test/general.shard/terminal_handler_test.dart
+++ b/packages/flutter_tools/test/general.shard/terminal_handler_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:async';
import 'package:file/file.dart';
@@ -945,14 +943,14 @@
listViews,
FakeVmServiceRequest(
method: 'ext.flutter.debugAllowBanner',
- args: <String, Object>{
+ args: <String, Object?>{
'isolateId': fakeUnpausedIsolate.id,
'enabled': 'false',
},
),
FakeVmServiceRequest(
method: 'ext.flutter.debugAllowBanner',
- args: <String, Object>{
+ args: <String, Object?>{
'isolateId': fakeUnpausedIsolate.id,
'enabled': 'true',
},
@@ -971,7 +969,7 @@
listViews,
FakeVmServiceRequest(
method: 'ext.flutter.debugAllowBanner',
- args: <String, Object>{
+ args: <String, Object?>{
'isolateId': fakeUnpausedIsolate.id,
'enabled': 'false',
},
@@ -985,7 +983,7 @@
),
FakeVmServiceRequest(
method: 'ext.flutter.debugAllowBanner',
- args: <String, Object>{
+ args: <String, Object?>{
'isolateId': fakeUnpausedIsolate.id,
'enabled': 'true',
},
@@ -1005,7 +1003,7 @@
listViews,
FakeVmServiceRequest(
method: 'ext.flutter.debugAllowBanner',
- args: <String, Object>{
+ args: <String, Object?>{
'isolateId': fakeUnpausedIsolate.id,
'enabled': 'false',
},
@@ -1019,7 +1017,7 @@
),
FakeVmServiceRequest(
method: 'ext.flutter.debugAllowBanner',
- args: <String, Object>{
+ args: <String, Object?>{
'isolateId': fakeUnpausedIsolate.id,
'enabled': 'true',
},
@@ -1090,7 +1088,7 @@
listViews,
FakeVmServiceRequest(
method: 'ext.flutter.debugAllowBanner',
- args: <String, Object>{
+ args: <String, Object?>{
'isolateId': fakeUnpausedIsolate.id,
'enabled': 'false',
},
@@ -1115,7 +1113,7 @@
listViews,
FakeVmServiceRequest(
method: 'ext.flutter.debugAllowBanner',
- args: <String, Object>{
+ args: <String, Object?>{
'isolateId': fakeUnpausedIsolate.id,
'enabled': 'false',
},
@@ -1127,7 +1125,7 @@
),
FakeVmServiceRequest(
method: 'ext.flutter.debugAllowBanner',
- args: <String, Object>{
+ args: <String, Object?>{
'isolateId': fakeUnpausedIsolate.id,
'enabled': 'true',
},
@@ -1150,7 +1148,7 @@
listViews,
FakeVmServiceRequest(
method: 'ext.flutter.debugAllowBanner',
- args: <String, Object>{
+ args: <String, Object?>{
'isolateId': fakeUnpausedIsolate.id,
'enabled': 'false',
},
@@ -1162,7 +1160,7 @@
),
FakeVmServiceRequest(
method: 'ext.flutter.debugAllowBanner',
- args: <String, Object>{
+ args: <String, Object?>{
'isolateId': fakeUnpausedIsolate.id,
'enabled': 'true',
},
@@ -1186,14 +1184,14 @@
listViews,
FakeVmServiceRequest(
method: 'ext.flutter.debugAllowBanner',
- args: <String, Object>{
+ args: <String, Object?>{
'isolateId': fakeUnpausedIsolate.id,
'enabled': 'false',
},
),
FakeVmServiceRequest(
method: 'ext.flutter.debugAllowBanner',
- args: <String, Object>{
+ args: <String, Object?>{
'isolateId': fakeUnpausedIsolate.id,
'enabled': 'true',
},
@@ -1309,7 +1307,7 @@
}
@override
- void printHelp({bool details}) {
+ void printHelp({required bool details}) {
if (details) {
calledPrintWithDetails = true;
} else {
@@ -1321,7 +1319,7 @@
Future<void> runSourceGenerators() async { }
@override
- Future<OperationResult> restart({bool fullRestart = false, bool pause = false, String reason}) async {
+ Future<OperationResult> restart({bool fullRestart = false, bool pause = false, String? reason}) async {
if (fullRestart && !supportsRestart) {
throw StateError('illegal restart');
}
@@ -1345,7 +1343,7 @@
bool calledLaunchDevToolsInBrowser = false;
@override
- bool launchDevToolsInBrowser({List<FlutterDevice> flutterDevices}) {
+ bool launchDevToolsInBrowser({List<FlutterDevice?>? flutterDevices}) {
return calledLaunchDevToolsInBrowser = true;
}
}
@@ -1382,8 +1380,8 @@
bool supportsScreenshot = false,
int reloadExitCode = 0,
BuildMode buildMode = BuildMode.debug,
- Logger logger,
- FileSystem fileSystem,
+ Logger? logger,
+ FileSystem? fileSystem,
}) {
final Logger testLogger = logger ?? BufferLogger.test();
final Signals signals = Signals.test();
@@ -1440,7 +1438,7 @@
class TestRunner extends Fake implements ResidentRunner {
bool hasHelpBeenPrinted = false;
- String receivedCommand;
+ String? receivedCommand;
@override
Future<void> cleanupAfterSignal() async { }
@@ -1449,22 +1447,22 @@
Future<void> cleanupAtFinish() async { }
@override
- void printHelp({ bool details }) {
+ void printHelp({ bool? details }) {
hasHelpBeenPrinted = true;
}
@override
- Future<int> run({
- Completer<DebugConnectionInfo> connectionInfoCompleter,
- Completer<void> appStartedCompleter,
+ Future<int?> run({
+ Completer<DebugConnectionInfo>? connectionInfoCompleter,
+ Completer<void>? appStartedCompleter,
bool enableDevTools = false,
- String route,
+ String? route,
}) async => null;
@override
- Future<int> attach({
- Completer<DebugConnectionInfo> connectionInfoCompleter,
- Completer<void> appStartedCompleter,
+ Future<int?> attach({
+ Completer<DebugConnectionInfo>? connectionInfoCompleter,
+ Completer<void>? appStartedCompleter,
bool allowExistingDdsInstance = false,
bool enableDevTools = false,
bool needsFullRestart = true,
@@ -1491,10 +1489,10 @@
if (!_handlersTable.containsKey(signal)) {
return false;
}
- if (!_handlersTable[signal].containsKey(token)) {
+ if (!_handlersTable[signal]!.containsKey(token)) {
return false;
}
- _handlersTable[signal].remove(token);
+ _handlersTable[signal]!.remove(token);
return true;
}
diff --git a/packages/flutter_tools/test/general.shard/test/test_compiler_test.dart b/packages/flutter_tools/test/general.shard/test/test_compiler_test.dart
index 415e877..cb743f8 100644
--- a/packages/flutter_tools/test/general.shard/test/test_compiler_test.dart
+++ b/packages/flutter_tools/test/general.shard/test/test_compiler_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/base/file_system.dart';
@@ -33,8 +31,8 @@
);
void main() {
- FakeResidentCompiler residentCompiler;
- FileSystem fileSystem;
+ late FakeResidentCompiler residentCompiler;
+ late FileSystem fileSystem;
setUp(() {
fileSystem = MemoryFileSystem.test();
@@ -149,8 +147,7 @@
await testCompiler.compile(Uri.parse('test/foo.dart'));
- final File generatedMain = fileSystem
- .directory('.dart_tool')
+ final File generatedMain = fileSystem.directory('.dart_tool')
.childDirectory('flutter_build')
.childFile('dart_plugin_registrant.dart');
@@ -170,17 +167,17 @@
/// Override the creation of the Resident Compiler to simplify testing.
class FakeTestCompiler extends TestCompiler {
FakeTestCompiler(
- BuildInfo buildInfo,
- FlutterProject flutterProject,
+ super.buildInfo,
+ super.flutterProject,
this.residentCompiler, {
- String precompiledDillPath,
+ super.precompiledDillPath,
}
- ) : super(buildInfo, flutterProject, precompiledDillPath: precompiledDillPath);
+ );
- final FakeResidentCompiler residentCompiler;
+ final FakeResidentCompiler? residentCompiler;
@override
- Future<ResidentCompiler> createCompiler() async {
+ Future<ResidentCompiler?> createCompiler() async {
return residentCompiler;
}
}
@@ -188,24 +185,24 @@
class FakeResidentCompiler extends Fake implements ResidentCompiler {
FakeResidentCompiler(this.fileSystem);
- final FileSystem fileSystem;
+ final FileSystem? fileSystem;
- CompilerOutput compilerOutput;
+ CompilerOutput? compilerOutput;
bool didShutdown = false;
@override
- Future<CompilerOutput> recompile(
+ Future<CompilerOutput?> recompile(
Uri mainUri,
- List<Uri> invalidatedFiles, {
- String outputPath,
- PackageConfig packageConfig,
- String projectRootPath,
- FileSystem fs,
+ List<Uri>? invalidatedFiles, {
+ String? outputPath,
+ PackageConfig? packageConfig,
+ String? projectRootPath,
+ FileSystem? fs,
bool suppressErrors = false,
bool checkDartPluginRegistry = false,
}) async {
if (compilerOutput != null) {
- fileSystem.file(compilerOutput.outputFilename).createSync(recursive: true);
+ fileSystem!.file(compilerOutput!.outputFilename).createSync(recursive: true);
}
return compilerOutput;
}
@@ -217,7 +214,8 @@
void reset() { }
@override
- Future<void> shutdown() async {
+ Future<Object> shutdown() async {
didShutdown = true;
+ return Object();
}
}
diff --git a/packages/flutter_tools/test/general.shard/testbed_test.dart b/packages/flutter_tools/test/general.shard/testbed_test.dart
index d34211d..135bb54 100644
--- a/packages/flutter_tools/test/general.shard/testbed_test.dart
+++ b/packages/flutter_tools/test/general.shard/testbed_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:async';
import 'dart:io';
@@ -24,7 +22,7 @@
test('Can provide default interfaces', () async {
final Testbed testbed = Testbed();
- FileSystem localFileSystem;
+ late FileSystem localFileSystem;
await testbed.run(() {
localFileSystem = globals.fs;
});
@@ -39,7 +37,7 @@
A: () => A(),
});
- A instance;
+ A? instance;
await testbed.run(() {
instance = context.get<A>();
});
@@ -52,7 +50,7 @@
A: () => A(),
});
- A instance;
+ A? instance;
await testbed.run(() {
instance = context.get<A>();
}, overrides: <Type, Generator>{
diff --git a/packages/flutter_tools/test/general.shard/version_test.dart b/packages/flutter_tools/test/general.shard/version_test.dart
index 41c6086..38febc6 100644
--- a/packages/flutter_tools/test/general.shard/version_test.dart
+++ b/packages/flutter_tools/test/general.shard/version_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:convert';
import 'package:flutter_tools/src/base/logger.dart';
@@ -24,8 +22,8 @@
final DateTime _stampOutOfDate = _testClock.ago(VersionFreshnessValidator.checkAgeConsideredUpToDate * 2);
void main() {
- FakeCache cache;
- FakeProcessManager processManager;
+ late FakeCache cache;
+ late FakeProcessManager processManager;
setUp(() {
processManager = FakeProcessManager.empty();
@@ -323,15 +321,15 @@
const String flutterNonStandardUrlDotGit = 'https://githubmirror.com/flutter/flutter.git';
const String flutterStandardSshUrlDotGit = 'git@github.com:flutter/flutter.git';
- VersionCheckError runUpstreamValidator({
- String versionUpstreamUrl,
- String flutterGitUrl,
+ VersionCheckError? runUpstreamValidator({
+ String? versionUpstreamUrl,
+ String? flutterGitUrl,
}){
final Platform testPlatform = FakePlatform(environment: <String, String> {
if (flutterGitUrl != null) 'FLUTTER_GIT_URL': flutterGitUrl,
});
return VersionUpstreamValidator(
- version: FakeFlutterVersion(repositoryUrl: versionUpstreamUrl),
+ version: FakeFlutterVersion(repositoryUrl: versionUpstreamUrl, channel: 'master'),
platform: testPlatform,
).run();
}
@@ -339,7 +337,7 @@
testWithoutContext('returns error if repository url is null', () {
final VersionCheckError error = runUpstreamValidator(
// repositoryUrl is null by default
- );
+ )!;
expect(error, isNotNull);
expect(
error.message,
@@ -352,7 +350,7 @@
});
testWithoutContext('returns error at non-standard remote url with FLUTTER_GIT_URL unset', () {
- final VersionCheckError error = runUpstreamValidator(versionUpstreamUrl: flutterNonStandardUrlDotGit);
+ final VersionCheckError error = runUpstreamValidator(versionUpstreamUrl: flutterNonStandardUrlDotGit)!;
expect(error, isNotNull);
expect(
error.message,
@@ -375,7 +373,7 @@
final VersionCheckError error = runUpstreamValidator(
versionUpstreamUrl: flutterStandardUrlDotGit,
flutterGitUrl: flutterNonStandardUrlDotGit,
- );
+ )!;
expect(error, isNotNull);
expect(
error.message,
@@ -673,7 +671,7 @@
}
class FakeCache extends Fake implements Cache {
- String versionStamp;
+ String? versionStamp;
bool setVersionStamp = false;
@override
@@ -689,7 +687,7 @@
void checkLockAcquired() { }
@override
- String getStampFor(String artifactName) {
+ String? getStampFor(String artifactName) {
if (artifactName == VersionCheckStamp.flutterVersionCheckStampFile) {
return versionStamp;
}
@@ -705,11 +703,11 @@
}
class FakeFlutterVersion extends Fake implements FlutterVersion {
- FakeFlutterVersion({this.channel, this.repositoryUrl});
+ FakeFlutterVersion({required this.channel, this.repositoryUrl});
@override
final String channel;
@override
- final String repositoryUrl;
+ final String? repositoryUrl;
}
diff --git a/packages/flutter_tools/test/general.shard/windows/application_package_test.dart b/packages/flutter_tools/test/general.shard/windows/application_package_test.dart
index 6af3a4b..29857b4 100644
--- a/packages/flutter_tools/test/general.shard/windows/application_package_test.dart
+++ b/packages/flutter_tools/test/general.shard/windows/application_package_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart';
@@ -17,9 +15,9 @@
void main() {
group('PrebuiltWindowsApp', () {
- FakeOperatingSystemUtils os;
- FileSystem fileSystem;
- BufferLogger logger;
+ late FakeOperatingSystemUtils os;
+ late FileSystem fileSystem;
+ late BufferLogger logger;
final Map<Type, Generator> overrides = <Type, Generator>{
FileSystem: () => fileSystem,
@@ -35,7 +33,7 @@
});
testUsingContext('Error on non-existing exe file', () {
- final PrebuiltWindowsApp windowsApp = WindowsApp.fromPrebuiltApp(fileSystem.file('not_existing.exe')) as PrebuiltWindowsApp;
+ final PrebuiltWindowsApp? windowsApp = WindowsApp.fromPrebuiltApp(fileSystem.file('not_existing.exe')) as PrebuiltWindowsApp?;
expect(windowsApp, isNull);
expect(logger.errorText, contains('File "not_existing.exe" does not exist.'));
@@ -43,13 +41,13 @@
testUsingContext('Success on exe file', () {
fileSystem.file('file.exe').createSync();
- final PrebuiltWindowsApp windowsApp = WindowsApp.fromPrebuiltApp(fileSystem.file('file.exe')) as PrebuiltWindowsApp;
+ final PrebuiltWindowsApp windowsApp = WindowsApp.fromPrebuiltApp(fileSystem.file('file.exe'))! as PrebuiltWindowsApp;
expect(windowsApp.name, 'file.exe');
}, overrides: overrides);
testUsingContext('Error on non-existing zip file', () {
- final PrebuiltWindowsApp windowsApp = WindowsApp.fromPrebuiltApp(fileSystem.file('not_existing.zip')) as PrebuiltWindowsApp;
+ final PrebuiltWindowsApp? windowsApp = WindowsApp.fromPrebuiltApp(fileSystem.file('not_existing.zip')) as PrebuiltWindowsApp?;
expect(windowsApp, isNull);
expect(logger.errorText, contains('File "not_existing.zip" does not exist.'));
@@ -57,7 +55,7 @@
testUsingContext('Bad zipped app, no payload dir', () {
fileSystem.file('app.zip').createSync();
- final PrebuiltWindowsApp windowsApp = WindowsApp.fromPrebuiltApp(fileSystem.file('app.zip')) as PrebuiltWindowsApp;
+ final PrebuiltWindowsApp? windowsApp = WindowsApp.fromPrebuiltApp(fileSystem.file('app.zip')) as PrebuiltWindowsApp?;
expect(windowsApp, isNull);
expect(logger.errorText, contains('Cannot find .exe files in the zip archive.'));
@@ -74,7 +72,7 @@
fileSystem.directory(exePath1).createSync(recursive: true);
fileSystem.directory(exePath2).createSync(recursive: true);
};
- final PrebuiltWindowsApp windowsApp = WindowsApp.fromPrebuiltApp(fileSystem.file('app.zip')) as PrebuiltWindowsApp;
+ final PrebuiltWindowsApp? windowsApp = WindowsApp.fromPrebuiltApp(fileSystem.file('app.zip')) as PrebuiltWindowsApp?;
expect(windowsApp, isNull);
expect(logger.errorText, contains('Archive "app.zip" contains more than one .exe files.'));
@@ -82,7 +80,7 @@
testUsingContext('Success with zipped app', () {
fileSystem.file('app.zip').createSync();
- String exePath;
+ String? exePath;
os.unzipOverride = (File zipFile, Directory targetDirectory) {
if (zipFile.path != 'app.zip') {
return;
@@ -90,7 +88,7 @@
exePath = fileSystem.path.join(targetDirectory.path, 'app.exe');
fileSystem.directory(exePath).createSync(recursive: true);
};
- final PrebuiltWindowsApp windowsApp = WindowsApp.fromPrebuiltApp(fileSystem.file('app.zip')) as PrebuiltWindowsApp;
+ final PrebuiltWindowsApp windowsApp = WindowsApp.fromPrebuiltApp(fileSystem.file('app.zip'))! as PrebuiltWindowsApp;
expect(logger.errorText, isEmpty);
expect(windowsApp.name, exePath);
@@ -99,7 +97,7 @@
testUsingContext('Error on unknown file type', () {
fileSystem.file('not_existing.app').createSync();
- final PrebuiltWindowsApp windowsApp = WindowsApp.fromPrebuiltApp(fileSystem.file('not_existing.app')) as PrebuiltWindowsApp;
+ final PrebuiltWindowsApp? windowsApp = WindowsApp.fromPrebuiltApp(fileSystem.file('not_existing.app')) as PrebuiltWindowsApp?;
expect(windowsApp, isNull);
expect(logger.errorText, contains('Unknown windows application type.'));
@@ -110,7 +108,7 @@
class FakeOperatingSystemUtils extends Fake implements OperatingSystemUtils {
FakeOperatingSystemUtils();
- void Function(File, Directory) unzipOverride;
+ void Function(File, Directory)? unzipOverride;
@override
void unzip(File file, Directory targetDirectory) {
diff --git a/packages/flutter_tools/test/integration.shard/expression_evaluation_test.dart b/packages/flutter_tools/test/integration.shard/expression_evaluation_test.dart
index 28b853b..90ab661 100644
--- a/packages/flutter_tools/test/integration.shard/expression_evaluation_test.dart
+++ b/packages/flutter_tools/test/integration.shard/expression_evaluation_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/file.dart';
import 'package:vm_service/vm_service.dart';
@@ -16,8 +14,8 @@
void batch1() {
final BasicProject project = BasicProject();
- Directory tempDir;
- FlutterRunTestDriver flutter;
+ late Directory tempDir;
+ late FlutterRunTestDriver flutter;
Future<void> initProject() async {
tempDir = createResolvedTempDirectorySync('run_expression_eval_test.');
@@ -95,8 +93,8 @@
void batch2() {
final TestsProject project = TestsProject();
- Directory tempDir;
- FlutterTestTestDriver flutter;
+ late Directory tempDir;
+ late FlutterTestTestDriver flutter;
Future<void> initProject() async {
tempDir = createResolvedTempDirectorySync('test_expression_eval_test.');
@@ -105,7 +103,7 @@
}
Future<void> cleanProject() async {
- await flutter?.waitForCompletion();
+ await flutter.waitForCompletion();
tryToDelete(tempDir);
}
@@ -165,14 +163,14 @@
final DateTime date = DateTime(2000);
final ObjRef resp = await flutter.evaluateInFrame('new DateTime(2000)');
expectInstanceOfClass(resp, 'DateTime');
- final ObjRef res = await flutter.evaluate(resp.id, r'"$year-$month-$day"');
+ final ObjRef res = await flutter.evaluate(resp.id!, r'"$year-$month-$day"');
expectValue(res, '${date.year}-${date.month}-${date.day}');
}
void expectInstanceOfClass(ObjRef result, String name) {
expect(result,
const TypeMatcher<InstanceRef>()
- .having((InstanceRef instance) => instance.classRef.name, 'resp.classRef.name', name));
+ .having((InstanceRef instance) => instance.classRef!.name, 'resp.classRef.name', name));
}
void expectValueOfType(ObjRef result, String kind, String message) {
diff --git a/packages/flutter_tools/test/integration.shard/migrate_config_test.dart b/packages/flutter_tools/test/integration.shard/migrate_config_test.dart
index 9973356..0792d30 100644
--- a/packages/flutter_tools/test/integration.shard/migrate_config_test.dart
+++ b/packages/flutter_tools/test/integration.shard/migrate_config_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:file/file.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/flutter_project_metadata.dart';
@@ -17,9 +15,9 @@
void main() {
- Directory tempDir;
- FlutterRunTestDriver flutter;
- Logger logger;
+ late Directory tempDir;
+ late FlutterRunTestDriver flutter;
+ late Logger logger;
setUp(() async {
tempDir = createResolvedTempDirectorySync('run_test.');
@@ -71,11 +69,11 @@
''', flush: true);
FlutterProjectMetadata metadata = FlutterProjectMetadata(metadataFile, logger);
- expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.root].createRevision, equals('fj19vkla9vnlka9vni3n808v3nch8cd'));
- expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.root].baseRevision, equals('93kf9v3njfa90vnidfjvn39nvi3vnie'));
+ expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.root]!.createRevision, equals('fj19vkla9vnlka9vni3n808v3nch8cd'));
+ expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.root]!.baseRevision, equals('93kf9v3njfa90vnidfjvn39nvi3vnie'));
- expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.android].createRevision, equals('abfj19vkla9vnlka9vni3n808v3nch8cd'));
- expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.android].baseRevision, equals('ab93kf9v3njfa90vnidfjvn39nvi3vnie'));
+ expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.android]!.createRevision, equals('abfj19vkla9vnlka9vni3n808v3nch8cd'));
+ expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.android]!.baseRevision, equals('ab93kf9v3njfa90vnidfjvn39nvi3vnie'));
expect(metadata.migrateConfig.unmanagedFiles[0], equals('lib/main.dart'));
expect(metadata.migrateConfig.unmanagedFiles[1], equals('ios/Runner.xcodeproj/project.pbxproj'));
@@ -169,8 +167,6 @@
projectDirectory: tempDir,
currentRevision: currentRevision,
createRevision: createRevision,
- create: true,
- update: true,
logger: logger,
);
@@ -179,16 +175,16 @@
final List<SupportedPlatform> keyList = List<SupportedPlatform>.from(metadata.migrateConfig.platformConfigs.keys);
expect(keyList[0], equals(SupportedPlatform.root));
- expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.root].baseRevision, equals(currentRevision));
- expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.root].createRevision, equals(createRevision));
+ expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.root]!.baseRevision, equals(currentRevision));
+ expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.root]!.createRevision, equals(createRevision));
expect(keyList[1], equals(SupportedPlatform.android));
- expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.android].baseRevision, equals(currentRevision));
- expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.android].createRevision, equals(createRevision));
+ expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.android]!.baseRevision, equals(currentRevision));
+ expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.android]!.createRevision, equals(createRevision));
expect(keyList[2], equals(SupportedPlatform.ios));
- expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.ios].baseRevision, equals(currentRevision));
- expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.ios].createRevision, equals(createRevision));
+ expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.ios]!.baseRevision, equals(currentRevision));
+ expect(metadata.migrateConfig.platformConfigs[SupportedPlatform.ios]!.createRevision, equals(createRevision));
final File metadataFileOutput = tempDir.childFile('.metadata_output');
metadata.writeFile(outputFile: metadataFileOutput);
diff --git a/packages/flutter_tools/test/integration.shard/project_validator_integration_test.dart b/packages/flutter_tools/test/integration.shard/project_validator_integration_test.dart
index f2a84d9..33a3727 100644
--- a/packages/flutter_tools/test/integration.shard/project_validator_integration_test.dart
+++ b/packages/flutter_tools/test/integration.shard/project_validator_integration_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'package:args/command_runner.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/logger.dart';
@@ -15,7 +13,7 @@
import '../src/test_flutter_command_runner.dart';
void main() {
- FileSystem fileSystem;
+ late FileSystem fileSystem;
group('analyze project command', () {
diff --git a/packages/flutter_tools/test/integration.shard/test_driver.dart b/packages/flutter_tools/test/integration.shard/test_driver.dart
index fb0ffa0..654efbd 100644
--- a/packages/flutter_tools/test/integration.shard/test_driver.dart
+++ b/packages/flutter_tools/test/integration.shard/test_driver.dart
@@ -849,9 +849,9 @@
await resume();
- final Future<Object> timeoutFuture =
- Future<Object>.delayed(defaultTimeout);
- await Future.any<Object>(<Future<Object>>[done.future, timeoutFuture]);
+ final Future<void> timeoutFuture =
+ Future<void>.delayed(defaultTimeout);
+ await Future.any<void>(<Future<void>>[done.future, timeoutFuture]);
await subscription.cancel();
if (!done.isCompleted) {
await quit();
diff --git a/packages/flutter_tools/test/integration.shard/web_plugin_registrant_test.dart b/packages/flutter_tools/test/integration.shard/web_plugin_registrant_test.dart
index 1de865c..48e0b28 100644
--- a/packages/flutter_tools/test/integration.shard/web_plugin_registrant_test.dart
+++ b/packages/flutter_tools/test/integration.shard/web_plugin_registrant_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.8
-
import 'dart:async';
import 'package:args/command_runner.dart';
@@ -21,8 +19,8 @@
import '../src/test_flutter_command_runner.dart';
void main() {
- Directory tempDir;
- Directory projectDir;
+ late Directory tempDir;
+ late Directory projectDir;
setUpAll(() async {
Cache.disableLocking();
@@ -195,8 +193,8 @@
Future<void> _addDependency(
Directory projectDir,
String package, {
- String version,
- String path,
+ String? version,
+ String? path,
}) async {
assert(version != null || path != null,
'Need to define a source for the package.');
@@ -249,7 +247,7 @@
];
final ProcessResult exec = await Process.run(
- globals.artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
+ globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
args,
workingDirectory: target is Directory ? target.path : target.dirname,
);
@@ -277,7 +275,7 @@
];
final ProcessResult exec = await Process.run(
- globals.artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
+ globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
args,
workingDirectory: workingDir.path,
);