diff --git a/packages/flutter_tools/test/integration.shard/daemon_mode_test.dart b/packages/flutter_tools/test/integration.shard/daemon_mode_test.dart index 7879d1ef71..c8d4b3952b 100644 --- a/packages/flutter_tools/test/integration.shard/daemon_mode_test.dart +++ b/packages/flutter_tools/test/integration.shard/daemon_mode_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' hide Directory; @@ -17,8 +15,8 @@ import 'test_driver.dart'; import 'test_utils.dart'; void main() { - Directory tempDir; - Process daemonProcess; + late Directory tempDir; + late Process daemonProcess; setUp(() async { tempDir = createResolvedTempDirectorySync('daemon_mode_test.'); @@ -26,7 +24,7 @@ void main() { tearDown(() async { tryToDelete(tempDir); - daemonProcess?.kill(); + daemonProcess.kill(); }); testWithoutContext('device.getDevices', () async { @@ -43,12 +41,12 @@ void main() { final StreamController stdout = StreamController.broadcast(); transformToLines(daemonProcess.stdout).listen((String line) => stdout.add(line)); - final Stream> stream = stdout + final Stream?> stream = stdout .stream - .map>(parseFlutterResponse) - .where((Map value) => value != null); + .map?>(parseFlutterResponse) + .where((Map? value) => value != null); - Map response = await stream.first; + Map response = (await stream.first)!; expect(response['event'], 'daemon.connected'); // start listening for devices @@ -56,13 +54,13 @@ void main() { 'id': 1, 'method': 'device.enable', })}]'); - response = await stream.firstWhere((Map json) => json['id'] == 1); + response = (await stream.firstWhere((Map? json) => json!['id'] == 1))!; expect(response['id'], 1); expect(response['error'], isNull); // [{"event":"device.added","params":{"id":"flutter-tester","name": // "Flutter test device","platform":"flutter-tester","emulator":false}}] - response = await stream.first; + response = (await stream.first)!; expect(response['event'], 'device.added'); // get the list of all devices @@ -71,7 +69,7 @@ void main() { 'method': 'device.getDevices', })}]'); // Skip other device.added events that may fire (desktop/web devices). - response = await stream.firstWhere((Map response) => response['event'] != 'device.added'); + response = (await stream.firstWhere((Map? response) => response!['event'] != 'device.added'))!; expect(response['id'], 2); expect(response['error'], isNull); diff --git a/packages/flutter_tools/test/integration.shard/deprecated_gradle_settings_test.dart b/packages/flutter_tools/test/integration.shard/deprecated_gradle_settings_test.dart index 142812120d..d9e9a4c55f 100644 --- a/packages/flutter_tools/test/integration.shard/deprecated_gradle_settings_test.dart +++ b/packages/flutter_tools/test/integration.shard/deprecated_gradle_settings_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/base/io.dart'; diff --git a/packages/flutter_tools/test/integration.shard/downgrade_upgrade_integration_test.dart b/packages/flutter_tools/test/integration.shard/downgrade_upgrade_integration_test.dart index 395a117653..3b8a49558f 100644 --- a/packages/flutter_tools/test/integration.shard/downgrade_upgrade_integration_test.dart +++ b/packages/flutter_tools/test/integration.shard/downgrade_upgrade_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:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/logger.dart'; @@ -29,7 +27,7 @@ final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', platform /// A test for flutter upgrade & downgrade that checks out a parallel flutter repo. void main() { - Directory parentDirectory; + late Directory parentDirectory; setUp(() { parentDirectory = fileSystem.systemTempDirectory diff --git a/packages/flutter_tools/test/integration.shard/exit_code_test.dart b/packages/flutter_tools/test/integration.shard/exit_code_test.dart index e6b3e6e413..88d07b3930 100644 --- a/packages/flutter_tools/test/integration.shard/exit_code_test.dart +++ b/packages/flutter_tools/test/integration.shard/exit_code_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/io.dart'; @@ -12,7 +10,7 @@ import 'test_utils.dart'; void main() { final String dartBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'dart'); - Directory tempDir; + late Directory tempDir; setUp(() { tempDir = createResolvedTempDirectorySync('exit_code_test.'); diff --git a/packages/flutter_tools/test/integration.shard/flutter_attach_test.dart b/packages/flutter_tools/test/integration.shard/flutter_attach_test.dart index 9dda4777e4..5cc8b560fb 100644 --- a/packages/flutter_tools/test/integration.shard/flutter_attach_test.dart +++ b/packages/flutter_tools/test/integration.shard/flutter_attach_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'; @@ -13,9 +11,9 @@ import 'test_driver.dart'; import 'test_utils.dart'; void main() { - FlutterRunTestDriver flutterRun, flutterAttach; + late FlutterRunTestDriver flutterRun, flutterAttach; final BasicProject project = BasicProject(); - Directory tempDir; + late Directory tempDir; setUp(() async { tempDir = createResolvedTempDirectorySync('attach_test.'); @@ -39,28 +37,28 @@ void main() { testWithoutContext('can hot reload', () async { await flutterRun.run(withDebugger: true); - await flutterAttach.attach(flutterRun.vmServicePort); + await flutterAttach.attach(flutterRun.vmServicePort!); await flutterAttach.hotReload(); }); testWithoutContext('can detach, reattach, hot reload', () async { await flutterRun.run(withDebugger: true); - await flutterAttach.attach(flutterRun.vmServicePort); + await flutterAttach.attach(flutterRun.vmServicePort!); await flutterAttach.detach(); - await flutterAttach.attach(flutterRun.vmServicePort); + await flutterAttach.attach(flutterRun.vmServicePort!); await flutterAttach.hotReload(); }); testWithoutContext('killing process behaves the same as detach ', () async { await flutterRun.run(withDebugger: true); - await flutterAttach.attach(flutterRun.vmServicePort); + await flutterAttach.attach(flutterRun.vmServicePort!); await flutterAttach.quit(); flutterAttach = FlutterRunTestDriver( tempDir, logPrefix: 'ATTACH-2', spawnDdsInstance: false, ); - await flutterAttach.attach(flutterRun.vmServicePort); + await flutterAttach.attach(flutterRun.vmServicePort!); await flutterAttach.hotReload(); }); @@ -85,11 +83,11 @@ void main() { ); final Response response = await flutterRun.callServiceExtension('ext.flutter.connectedVmServiceUri'); - final String vmServiceUri = response.json['value'] as String; + final String vmServiceUri = response.json!['value'] as String; // Attach with a different DevTools server address. await flutterAttach.attach( - flutterRun.vmServicePort, + flutterRun.vmServicePort!, additionalCommandArgs: ['--devtools-server-address', 'http://127.0.0.1:9110'], ); await pollForServiceExtensionValue( diff --git a/packages/flutter_tools/test/integration.shard/flutter_build_android_app_project_builddir_test.dart b/packages/flutter_tools/test/integration.shard/flutter_build_android_app_project_builddir_test.dart index 375f34b45c..2f71f983dc 100644 --- a/packages/flutter_tools/test/integration.shard/flutter_build_android_app_project_builddir_test.dart +++ b/packages/flutter_tools/test/integration.shard/flutter_build_android_app_project_builddir_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/base/file_system.dart'; @@ -17,9 +15,9 @@ import 'test_utils.dart'; // `flutter build` command inside the `example` directory, so we create a plugin // project in the test. void main() { - Directory tempDir; - String flutterBin; - Directory exampleAppDir; + late Directory tempDir; + late String flutterBin; + late Directory exampleAppDir; setUp(() async { tempDir = createResolvedTempDirectorySync('flutter_plugin_test.'); diff --git a/packages/flutter_tools/test/integration.shard/flutter_build_null_unsafe_test.dart b/packages/flutter_tools/test/integration.shard/flutter_build_null_unsafe_test.dart index 42835e5f85..10326feed5 100644 --- a/packages/flutter_tools/test/integration.shard/flutter_build_null_unsafe_test.dart +++ b/packages/flutter_tools/test/integration.shard/flutter_build_null_unsafe_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/io.dart'; @@ -11,9 +9,9 @@ import '../src/common.dart'; import 'test_utils.dart'; void main() { - Directory tempDir; - Directory projectRoot; - String flutterBin; + late Directory tempDir; + late Directory projectRoot; + late String flutterBin; final List targetPlatforms = [ 'apk', 'web', diff --git a/packages/flutter_tools/test/integration.shard/flutter_build_with_compilation_error_test.dart b/packages/flutter_tools/test/integration.shard/flutter_build_with_compilation_error_test.dart index 2dbb1b351e..031201f110 100644 --- a/packages/flutter_tools/test/integration.shard/flutter_build_with_compilation_error_test.dart +++ b/packages/flutter_tools/test/integration.shard/flutter_build_with_compilation_error_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/io.dart'; @@ -11,9 +9,9 @@ import '../src/common.dart'; import 'test_utils.dart'; void main() { - Directory tempDir; - Directory projectRoot; - String flutterBin; + late Directory tempDir; + late Directory projectRoot; + late String flutterBin; final List targetPlatforms = [ 'apk', 'web', diff --git a/packages/flutter_tools/test/integration.shard/flutter_gen_test.dart b/packages/flutter_tools/test/integration.shard/flutter_gen_test.dart index 192e24ac0d..674d5a1c58 100644 --- a/packages/flutter_tools/test/integration.shard/flutter_gen_test.dart +++ b/packages/flutter_tools/test/integration.shard/flutter_gen_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'; @@ -14,9 +12,9 @@ import 'test_driver.dart'; import 'test_utils.dart'; void main() { - Directory tempDir; + late Directory tempDir; final BasicProjectWithFlutterGen project = BasicProjectWithFlutterGen(); - FlutterRunTestDriver flutter; + late FlutterRunTestDriver flutter; setUp(() async { tempDir = createResolvedTempDirectorySync('run_test.'); diff --git a/packages/flutter_tools/test/integration.shard/flutter_run_test.dart b/packages/flutter_tools/test/integration.shard/flutter_run_test.dart index 9d1792f9cb..8a58f03849 100644 --- a/packages/flutter_tools/test/integration.shard/flutter_run_test.dart +++ b/packages/flutter_tools/test/integration.shard/flutter_run_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/io.dart'; import 'package:process/process.dart'; @@ -14,9 +12,9 @@ import 'test_driver.dart'; import 'test_utils.dart'; void main() { - Directory tempDir; + late Directory tempDir; final BasicProject project = BasicProject(); - FlutterRunTestDriver flutter; + late FlutterRunTestDriver flutter; setUp(() async { tempDir = createResolvedTempDirectorySync('run_test.'); diff --git a/packages/flutter_tools/test/integration.shard/flutter_run_with_error_test.dart b/packages/flutter_tools/test/integration.shard/flutter_run_with_error_test.dart index 840f0a6c0b..970912efbe 100644 --- a/packages/flutter_tools/test/integration.shard/flutter_run_with_error_test.dart +++ b/packages/flutter_tools/test/integration.shard/flutter_run_with_error_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'; @@ -17,10 +15,10 @@ import 'test_driver.dart'; import 'test_utils.dart'; void main() { - Directory tempDir; + late Directory tempDir; final ProjectWithEarlyError project = ProjectWithEarlyError(); const String exceptionStart = '══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞══════════════════'; - FlutterRunTestDriver flutter; + late FlutterRunTestDriver flutter; setUp(() async { tempDir = createResolvedTempDirectorySync('run_test.'); @@ -56,14 +54,14 @@ void main() { if (line.startsWith('An Observatory debugger')) { final RegExp exp = RegExp(r'http://127.0.0.1:(\d+)/'); - final RegExpMatch match = exp.firstMatch(line); - final String port = match.group(1); + final RegExpMatch match = exp.firstMatch(line)!; + final String port = match.group(1)!; if (port != null) { final VmService vmService = await vmServiceConnectUri('ws://localhost:$port/ws'); final VM vm = await vmService.getVM(); - for (final IsolateRef isolate in vm.isolates) { - await vmService.resume(isolate.id); + for (final IsolateRef isolate in vm.isolates!) { + await vmService.resume(isolate.id!); } } } diff --git a/packages/flutter_tools/test/integration.shard/forbidden_imports_test.dart b/packages/flutter_tools/test/integration.shard/forbidden_imports_test.dart index 13f9f5d85e..92a886319a 100644 --- a/packages/flutter_tools/test/integration.shard/forbidden_imports_test.dart +++ b/packages/flutter_tools/test/integration.shard/forbidden_imports_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 '../src/common.dart'; diff --git a/packages/flutter_tools/test/integration.shard/gen_l10n_test.dart b/packages/flutter_tools/test/integration.shard/gen_l10n_test.dart index 8d1a2d153e..077e7ab24c 100644 --- a/packages/flutter_tools/test/integration.shard/gen_l10n_test.dart +++ b/packages/flutter_tools/test/integration.shard/gen_l10n_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'; @@ -19,8 +17,8 @@ final GenL10nProject project = GenL10nProject(); // It can fail if gen_l10n produces a lib/l10n/app_localizations.dart that // does not analyze cleanly. void main() { - Directory tempDir; - FlutterRunTestDriver flutter; + late Directory tempDir; + late FlutterRunTestDriver flutter; setUp(() async { tempDir = createResolvedTempDirectorySync('gen_l10n_test.'); diff --git a/packages/flutter_tools/test/integration.shard/gradle_non_android_plugin_test.dart b/packages/flutter_tools/test/integration.shard/gradle_non_android_plugin_test.dart index 1837c7ef61..3703ed600f 100644 --- a/packages/flutter_tools/test/integration.shard/gradle_non_android_plugin_test.dart +++ b/packages/flutter_tools/test/integration.shard/gradle_non_android_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_testing/file_testing.dart'; @@ -11,7 +9,7 @@ import '../src/common.dart'; import 'test_utils.dart'; void main() { - Directory tempDir; + late Directory tempDir; setUp(() { tempDir = createResolvedTempDirectorySync('flutter_plugin_test.'); diff --git a/packages/flutter_tools/test/integration.shard/hot_reload_errors_test.dart b/packages/flutter_tools/test/integration.shard/hot_reload_errors_test.dart index 48e5e46398..edddb6864b 100644 --- a/packages/flutter_tools/test/integration.shard/hot_reload_errors_test.dart +++ b/packages/flutter_tools/test/integration.shard/hot_reload_errors_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 '../src/common.dart'; @@ -12,9 +10,9 @@ import 'test_driver.dart'; import 'test_utils.dart'; void main() { - Directory tempDir; + late Directory tempDir; final HotReloadConstProject project = HotReloadConstProject(); - FlutterRunTestDriver flutter; + late FlutterRunTestDriver flutter; setUp(() async { tempDir = createResolvedTempDirectorySync('hot_reload_test.'); @@ -23,7 +21,7 @@ void main() { }); tearDown(() async { - await flutter?.stop(); + await flutter.stop(); tryToDelete(tempDir); }); diff --git a/packages/flutter_tools/test/integration.shard/hot_reload_test.dart b/packages/flutter_tools/test/integration.shard/hot_reload_test.dart index 9d7bf5eb36..71e91354cb 100644 --- a/packages/flutter_tools/test/integration.shard/hot_reload_test.dart +++ b/packages/flutter_tools/test/integration.shard/hot_reload_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'; @@ -15,9 +13,9 @@ import 'test_driver.dart'; import 'test_utils.dart'; void main() { - Directory tempDir; + late Directory tempDir; final HotReloadProject project = HotReloadProject(); - FlutterRunTestDriver flutter; + late FlutterRunTestDriver flutter; setUp(() async { tempDir = createResolvedTempDirectorySync('hot_reload_test.'); @@ -26,7 +24,7 @@ void main() { }); tearDown(() async { - await flutter?.stop(); + await flutter.stop(); tryToDelete(tempDir); }); @@ -123,7 +121,7 @@ void main() { await Future.delayed(const Duration(seconds: 2)); await flutter.hotReload(); // reload triggers code which eventually hits the breakpoint isolate = await flutter.waitForPause(); - expect(isolate.pauseEvent.kind, equals(EventKind.kPauseBreakpoint)); + expect(isolate.pauseEvent?.kind, equals(EventKind.kPauseBreakpoint)); await flutter.resume(); await flutter.addBreakpoint( project.buildBreakpointUri, @@ -133,7 +131,7 @@ void main() { final Future reloadFuture = flutter.hotReload().then((void value) { reloaded = true; }); printOnFailure('waiting for pause...'); isolate = await flutter.waitForPause(); - expect(isolate.pauseEvent.kind, equals(EventKind.kPauseBreakpoint)); + expect(isolate.pauseEvent?.kind, equals(EventKind.kPauseBreakpoint)); printOnFailure('waiting for debugger message...'); await sawDebuggerPausedMessage.future; expect(reloaded, isFalse); @@ -179,7 +177,7 @@ void main() { await Future.delayed(const Duration(seconds: 1)); final Future reloadFuture = flutter.hotReload().then((void value) { reloaded = true; }); final Isolate isolate = await flutter.waitForPause(); - expect(isolate.pauseEvent.kind, equals(EventKind.kPauseBreakpoint)); + expect(isolate.pauseEvent?.kind, equals(EventKind.kPauseBreakpoint)); expect(reloaded, isFalse); await sawDebuggerPausedMessage1.future; // this is the one where it say "uh, you broke into the debugger while reloading" await reloadFuture; // this is the one where it times out because you're in the debugger @@ -191,10 +189,10 @@ void main() { }); } -bool _isHotReloadCompletionEvent(Map event) { +bool _isHotReloadCompletionEvent(Map? event) { return event != null && event['event'] == 'app.progress' && event['params'] != null && - (event['params'] as Map)['progressId'] == 'hot.reload' && - (event['params'] as Map)['finished'] == true; + (event['params'] as Map?)!['progressId'] == 'hot.reload' && + (event['params'] as Map?)!['finished'] == true; } diff --git a/packages/flutter_tools/test/integration.shard/hot_reload_with_asset_test.dart b/packages/flutter_tools/test/integration.shard/hot_reload_with_asset_test.dart index 550c6f25e9..4de27d074f 100644 --- a/packages/flutter_tools/test/integration.shard/hot_reload_with_asset_test.dart +++ b/packages/flutter_tools/test/integration.shard/hot_reload_with_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 'dart:async'; import 'package:file/file.dart'; @@ -14,9 +12,9 @@ import 'test_driver.dart'; import 'test_utils.dart'; void main() { - Directory tempDir; + late Directory tempDir; final HotReloadWithAssetProject project = HotReloadWithAssetProject(); - FlutterRunTestDriver flutter; + late FlutterRunTestDriver flutter; setUp(() async { tempDir = createResolvedTempDirectorySync('hot_reload_test.'); @@ -25,7 +23,7 @@ void main() { }); tearDown(() async { - await flutter?.stop(); + await flutter.stop(); tryToDelete(tempDir); }); diff --git a/packages/flutter_tools/test/integration.shard/lifetime_test.dart b/packages/flutter_tools/test/integration.shard/lifetime_test.dart index 2be89363a7..bab2ee3e9f 100644 --- a/packages/flutter_tools/test/integration.shard/lifetime_test.dart +++ b/packages/flutter_tools/test/integration.shard/lifetime_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 '../src/common.dart'; @@ -18,8 +16,8 @@ const Duration requiredLifespan = Duration(seconds: 5); void main() { final BasicProject project = BasicProject(); - FlutterRunTestDriver flutter; - Directory tempDir; + late FlutterRunTestDriver flutter; + late Directory tempDir; setUp(() async { tempDir = createResolvedTempDirectorySync('lifetime_test.'); diff --git a/packages/flutter_tools/test/integration.shard/migrate_utils_test.dart b/packages/flutter_tools/test/integration.shard/migrate_utils_test.dart index 1e709419c6..c2d0e7325e 100644 --- a/packages/flutter_tools/test/integration.shard/migrate_utils_test.dart +++ b/packages/flutter_tools/test/integration.shard/migrate_utils_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/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; @@ -14,12 +12,12 @@ import 'package:flutter_tools/src/migrate/migrate_utils.dart'; import '../src/common.dart'; void main() { - BufferLogger logger; - FileSystem fileSystem; - Directory projectRoot; - String projectRootPath; - MigrateUtils utils; - ProcessUtils processUtils; + late BufferLogger logger; + late FileSystem fileSystem; + late Directory projectRoot; + late String projectRootPath; + late MigrateUtils utils; + late ProcessUtils processUtils; setUpAll(() async { fileSystem = globals.localFileSystem; diff --git a/packages/flutter_tools/test/integration.shard/multidex_build_test.dart b/packages/flutter_tools/test/integration.shard/multidex_build_test.dart index 8a194edc35..7bb5bf9875 100644 --- a/packages/flutter_tools/test/integration.shard/multidex_build_test.dart +++ b/packages/flutter_tools/test/integration.shard/multidex_build_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/io.dart'; @@ -13,8 +11,8 @@ import 'test_driver.dart'; import 'test_utils.dart'; void main() { - Directory tempDir; - FlutterRunTestDriver flutter; + late Directory tempDir; + late FlutterRunTestDriver flutter; setUp(() async { tempDir = createResolvedTempDirectorySync('run_test.'); diff --git a/packages/flutter_tools/test/integration.shard/observatory_port_test.dart b/packages/flutter_tools/test/integration.shard/observatory_port_test.dart index b47a62c1d5..e1d4241e64 100644 --- a/packages/flutter_tools/test/integration.shard/observatory_port_test.dart +++ b/packages/flutter_tools/test/integration.shard/observatory_port_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/file_system.dart'; @@ -43,7 +41,7 @@ Future waitForObservatoryMessage(Process process, int port) async { } void main() { - Directory tempDir; + late Directory tempDir; final BasicProject project = BasicProject(); setUp(() async { diff --git a/packages/flutter_tools/test/integration.shard/overall_experience_test.dart b/packages/flutter_tools/test/integration.shard/overall_experience_test.dart index b6cb75be77..06461e88cf 100644 --- a/packages/flutter_tools/test/integration.shard/overall_experience_test.dart +++ b/packages/flutter_tools/test/integration.shard/overall_experience_test.dart @@ -22,9 +22,6 @@ // To aid in debugging, consider passing the `debug: true` argument // to the runFlutter function. -// @dart = 2.8 -// This file is ready to transition, just uncomment /*?*/, /*!*/, and /*late*/. - // This file intentionally assumes the tests run in order. @Tags(['no-shuffle']) @@ -49,7 +46,7 @@ void debugPrint(String message) { print(message); } -typedef LineHandler = String/*?*/ Function(String line); +typedef LineHandler = String? Function(String line); abstract class Transition { const Transition({this.handler, this.logging}); @@ -59,12 +56,12 @@ abstract class Transition { /// This should not throw, even if the test is failing. (For example, don't use "expect" /// in these callbacks.) Throwing here would prevent the [runFlutter] function from running /// to completion, which would leave zombie `flutter` processes around. - final LineHandler/*?*/ handler; + final LineHandler? handler; /// Whether to enable or disable logging when this transition is matched. /// /// The default value, null, leaves the logging state unaffected. - final bool/*?*/ logging; + final bool? logging; bool matches(String line); @@ -89,7 +86,7 @@ abstract class Transition { } class Barrier extends Transition { - const Barrier(this.pattern, {LineHandler/*?*/ handler, bool/*?*/ logging}) : super(handler: handler, logging: logging); + const Barrier(this.pattern, {super.handler, super.logging}); final Pattern pattern; @override @@ -101,11 +98,10 @@ class Barrier extends Transition { class Multiple extends Transition { Multiple(List patterns, { - LineHandler/*?*/ handler, - bool/*?*/ logging, + super.handler, + super.logging, }) : _originalPatterns = patterns, - patterns = patterns.toList(), - super(handler: handler, logging: logging); + patterns = patterns.toList(); final List _originalPatterns; final List patterns; @@ -159,7 +155,7 @@ class LogLine { case 0x0D: return ''; } return '<${rune.toRadixString(16).padLeft(rune <= 0xFF ? 2 : rune <= 0xFFFF ? 4 : 5, '0')}>'; - }).join(''); + }).join(); } } @@ -222,7 +218,7 @@ Future runFlutter( } } bool streamingLogs = false; - Timer/*?*/ timeout; + Timer? timeout; void processTimeout() { if (!streamingLogs) { streamingLogs = true; @@ -235,7 +231,7 @@ Future runFlutter( debugPrint('(taking a long time...)'); } } - String stamp() => '[${(clock.elapsed.inMilliseconds / 1000.0).toStringAsFixed(1).padLeft(5, " ")}s]'; + String stamp() => '[${(clock.elapsed.inMilliseconds / 1000.0).toStringAsFixed(1).padLeft(5)}s]'; void processStdout(String line) { final LogLine log = LogLine('stdout', stamp(), line); if (logging) { @@ -249,10 +245,10 @@ Future runFlutter( debugPrint('(matched ${transitions[nextTransition]})'); } if (transitions[nextTransition].logging != null) { - if (!logging && transitions[nextTransition].logging/*!*/) { + if (!logging && transitions[nextTransition].logging!) { logs.add(log); } - logging = transitions[nextTransition].logging/*!*/; + logging = transitions[nextTransition].logging!; if (streamingLogs) { if (logging) { debugPrint('(enabled logging)'); @@ -262,7 +258,7 @@ Future runFlutter( } } if (transitions[nextTransition].handler != null) { - final String/*?*/ command = transitions[nextTransition].handler/*!*/(line); + final String? command = transitions[nextTransition].handler!(line); if (command != null) { final LogLine inLog = LogLine('stdin', stamp(), command); logs.add(inLog); @@ -333,7 +329,7 @@ void main() { final String tempDirectory = fileSystem.systemTempDirectory.createTempSync('flutter_overall_experience_test.').resolveSymbolicLinksSync(); final String pidFile = fileSystem.path.join(tempDirectory, 'flutter.pid'); final String testDirectory = fileSystem.path.join(flutterRoot, 'examples', 'hello_world'); - bool/*?*/ existsDuringTest; + bool? existsDuringTest; try { expect(fileSystem.file(pidFile).existsSync(), isFalse); final ProcessTestResult result = await runFlutter( @@ -367,7 +363,7 @@ void main() { final String pidFile = fileSystem.path.join(tempDirectory, 'flutter.pid'); final String testDirectory = fileSystem.path.join(flutterRoot, 'dev', 'integration_tests', 'ui'); final String testScript = fileSystem.path.join('lib', 'commands.dart'); - /*late*/ int pid; + late int pid; try { final ProcessTestResult result = await runFlutter( ['run', '-dflutter-tester', '--report-ready', '--pid-file', pidFile, '--no-devtools', testScript], diff --git a/packages/flutter_tools/test/integration.shard/plist_parser_test.dart b/packages/flutter_tools/test/integration.shard/plist_parser_test.dart index 5b28265869..dc8d2e8fa5 100644 --- a/packages/flutter_tools/test/integration.shard/plist_parser_test.dart +++ b/packages/flutter_tools/test/integration.shard/plist_parser_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/file_system.dart'; @@ -52,9 +50,9 @@ void main() { // `ProcessManager` because doing so wouldn't actually test what we want to // test, which is that the underlying tool we're using to parse Plist files // works with the way we're calling it. - File file; - PlistParser parser; - BufferLogger logger; + late File file; + late PlistParser parser; + late BufferLogger logger; setUp(() { logger = BufferLogger( diff --git a/packages/flutter_tools/test/integration.shard/single_widget_reload_test.dart b/packages/flutter_tools/test/integration.shard/single_widget_reload_test.dart index 6bd0b9f6ee..85ec32c59e 100644 --- a/packages/flutter_tools/test/integration.shard/single_widget_reload_test.dart +++ b/packages/flutter_tools/test/integration.shard/single_widget_reload_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/file_system.dart'; @@ -14,9 +12,9 @@ import 'test_driver.dart'; import 'test_utils.dart'; void main() { - Directory tempDir; + late Directory tempDir; final SingleWidgetReloadProject project = SingleWidgetReloadProject(); - FlutterRunTestDriver flutter; + late FlutterRunTestDriver flutter; setUp(() async { tempDir = createResolvedTempDirectorySync('hot_reload_test.'); @@ -25,7 +23,7 @@ void main() { }); tearDown(() async { - await flutter?.stop(); + await flutter.stop(); tryToDelete(tempDir); }); diff --git a/packages/flutter_tools/test/integration.shard/stateless_stateful_hot_reload_test.dart b/packages/flutter_tools/test/integration.shard/stateless_stateful_hot_reload_test.dart index 8a1068c9f7..311e45c02d 100644 --- a/packages/flutter_tools/test/integration.shard/stateless_stateful_hot_reload_test.dart +++ b/packages/flutter_tools/test/integration.shard/stateless_stateful_hot_reload_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'; @@ -16,9 +14,9 @@ import 'test_utils.dart'; // This test verifies that we can hot reload a stateless widget into a // stateful one and back. void main() { - Directory tempDir; + late Directory tempDir; final HotReloadProject project = HotReloadProject(); - FlutterRunTestDriver flutter; + late FlutterRunTestDriver flutter; setUp(() async { tempDir = createResolvedTempDirectorySync('hot_reload_test.'); @@ -27,7 +25,7 @@ void main() { }); tearDown(() async { - await flutter?.stop(); + await flutter.stop(); tryToDelete(tempDir); }); diff --git a/packages/flutter_tools/test/integration.shard/template_manifest_test.dart b/packages/flutter_tools/test/integration.shard/template_manifest_test.dart index 9101830c87..6709b13742 100644 --- a/packages/flutter_tools/test/integration.shard/template_manifest_test.dart +++ b/packages/flutter_tools/test/integration.shard/template_manifest_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/convert.dart'; import '../src/common.dart'; @@ -12,11 +10,11 @@ import 'test_utils.dart'; /// Checks that all active template files are defined in the template_manifest.json file. void main() { testWithoutContext('Check template manifest is up to date', () { - final Map manifest = json.decode( + final Map manifest = json.decode( fileSystem.file('templates/template_manifest.json').readAsStringSync(), - ) as Map; + ) as Map; final Set declaredFileList = Set.from( - (manifest['files'] as List).cast().map(fileSystem.path.toUri)); + (manifest['files'] as List?)!.cast().map(fileSystem.path.toUri)); final Set activeTemplateList = fileSystem.directory('templates') .listSync(recursive: true) diff --git a/packages/flutter_tools/test/integration.shard/test_test.dart b/packages/flutter_tools/test/integration.shard/test_test.dart index 778b217121..a37b430214 100644 --- a/packages/flutter_tools/test/integration.shard/test_test.dart +++ b/packages/flutter_tools/test/integration.shard/test_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 @@ -205,7 +203,7 @@ Future _testFile( String testName, String workingDirectory, String testDirectory, { - Matcher exitCode, + Matcher? exitCode, List extraArguments = const [], }) async { exitCode ??= isNonZero; @@ -287,7 +285,7 @@ Future _testFile( } Future _runFlutterTest( - String testName, + String? testName, String workingDirectory, String testDirectory, { List extraArguments = const [], diff --git a/packages/flutter_tools/test/integration.shard/timeline_test.dart b/packages/flutter_tools/test/integration.shard/timeline_test.dart index 9939b242d0..0d6fecde98 100644 --- a/packages/flutter_tools/test/integration.shard/timeline_test.dart +++ b/packages/flutter_tools/test/integration.shard/timeline_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'; @@ -16,9 +14,9 @@ import 'test_driver.dart'; import 'test_utils.dart'; void main() { - Directory tempDir; - FlutterRunTestDriver flutter; - VmService vmService; + late Directory tempDir; + late FlutterRunTestDriver flutter; + late VmService vmService; setUp(() async { tempDir = createResolvedTempDirectorySync('vmservice_integration_test.'); @@ -28,12 +26,12 @@ void main() { flutter = FlutterRunTestDriver(tempDir); await flutter.run(withDebugger: true); - final int port = flutter.vmServicePort; + final int? port = flutter.vmServicePort; vmService = await vmServiceConnectUri('ws://localhost:$port/ws'); }); tearDown(() async { - await flutter?.stop(); + await flutter.stop(); tryToDelete(tempDir); }); @@ -78,16 +76,16 @@ void main() { 'ext.flutter.brightnessOverride', isolateId: isolate.id, ); - expect(response.json['value'], 'Brightness.light'); + expect(response.json!['value'], 'Brightness.light'); } timer.cancel(); // Verify that all duration events on the timeline are properly nested. final Response response = await vmService.callServiceExtension('getVMTimeline'); - final List events = (response as Timeline).traceEvents; + final List? events = (response as Timeline).traceEvents; final Map> threadDurationEventStack = >{}; - for (final TimelineEvent e in events) { - final Map event = e.json; + for (final TimelineEvent e in events!) { + final Map event = e.json!; final String phase = event['ph'] as String; final int tid = event['tid'] as int; final String name = event['name'] as String; diff --git a/packages/flutter_tools/test/integration.shard/tool_backend_test.dart b/packages/flutter_tools/test/integration.shard/tool_backend_test.dart index f013eee449..56581bfd24 100644 --- a/packages/flutter_tools/test/integration.shard/tool_backend_test.dart +++ b/packages/flutter_tools/test/integration.shard/tool_backend_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/base/io.dart'; import '../src/common.dart'; diff --git a/packages/flutter_tools/test/integration.shard/unit_coverage_test.dart b/packages/flutter_tools/test/integration.shard/unit_coverage_test.dart index 56f0d2fab6..3d76018848 100644 --- a/packages/flutter_tools/test/integration.shard/unit_coverage_test.dart +++ b/packages/flutter_tools/test/integration.shard/unit_coverage_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/base/file_system.dart'; import 'package:flutter_tools/src/base/io.dart'; import 'package:process/process.dart'; @@ -12,7 +10,7 @@ import '../src/common.dart'; import 'test_utils.dart'; void main() { - Directory tempDir; + late Directory tempDir; setUp(() async { tempDir = createResolvedTempDirectorySync('unit_coverage_test.'); diff --git a/packages/flutter_tools/test/integration.shard/variable_expansion_windows_test.dart b/packages/flutter_tools/test/integration.shard/variable_expansion_windows_test.dart index 9787eeb302..a8c8c11dc1 100644 --- a/packages/flutter_tools/test/integration.shard/variable_expansion_windows_test.dart +++ b/packages/flutter_tools/test/integration.shard/variable_expansion_windows_test.dart @@ -2,7 +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/base/io.dart'; import '../src/common.dart'; diff --git a/packages/flutter_tools/test/integration.shard/xcode_backend_test.dart b/packages/flutter_tools/test/integration.shard/xcode_backend_test.dart index e9ef0fa5c3..01484aa6c2 100644 --- a/packages/flutter_tools/test/integration.shard/xcode_backend_test.dart +++ b/packages/flutter_tools/test/integration.shard/xcode_backend_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:io' as io; import 'package:flutter_tools/src/base/file_system.dart'; @@ -69,8 +67,8 @@ void main() { }, skip: !io.Platform.isMacOS); // [intended] requires macos toolchain. group('observatory Bonjour service keys', () { - Directory buildDirectory; - File infoPlist; + late Directory buildDirectory; + late File infoPlist; setUp(() { buildDirectory = globals.fs.systemTempDirectory.createTempSync('flutter_tools_xcode_backend_test.');