diff --git a/packages/flutter_tools/test/integration.shard/break_on_framework_exceptions_test.dart b/packages/flutter_tools/test/integration.shard/break_on_framework_exceptions_test.dart index 1ad607c47b..b127405dde 100644 --- a/packages/flutter_tools/test/integration.shard/break_on_framework_exceptions_test.dart +++ b/packages/flutter_tools/test/integration.shard/break_on_framework_exceptions_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 @@ -18,7 +16,7 @@ import 'test_driver.dart'; import 'test_utils.dart'; void main() { - Directory tempDir; + late Directory tempDir; setUp(() async { tempDir = createResolvedTempDirectorySync('break_on_framework_exceptions.'); @@ -43,7 +41,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'AnimationController listener';")); }); @@ -62,7 +60,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'AnimationController status listener';")); }); @@ -81,7 +79,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'ValueNotifier listener';")); }); @@ -108,7 +106,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'while handling a gesture';")); }); @@ -126,7 +124,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'platform message callback';")); }); @@ -147,7 +145,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'cannot build child';")); }); @@ -171,7 +169,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'onChanged';")); }); @@ -197,7 +195,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'onEditingComplete';")); }); @@ -219,7 +217,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'onSelectionChanged';")); }); @@ -238,7 +236,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'action listener';")); }); @@ -257,7 +255,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'pointer route';")); }); @@ -277,7 +275,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'PointerSignalResolver callback';")); }); @@ -297,7 +295,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'highlight mode listener';")); }); @@ -324,7 +322,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'onHover';")); }); @@ -350,7 +348,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'setImage';")); }); @@ -373,7 +371,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'onError';")); }); @@ -392,7 +390,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'LayoutBuilder.builder';")); }); @@ -411,7 +409,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw '_CallbackHookProvider.callback';")); }); @@ -429,7 +427,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'TimingsCallback';")); }); @@ -450,7 +448,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'scheduled task';")); }); @@ -468,7 +466,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'FrameCallback';")); }); @@ -494,7 +492,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'create element';")); }); @@ -517,7 +515,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'performLayout';")); }); @@ -543,7 +541,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'performResize';")); }); @@ -586,7 +584,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'performLayout without resize';")); }); @@ -609,7 +607,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'StatelessWidget.build';")); }); @@ -637,7 +635,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'StatefulWidget.build';")); }); @@ -669,7 +667,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'dispose';")); }); @@ -717,7 +715,7 @@ void main() { await flutter.test(withDebugger: true, pauseOnExceptions: true); await flutter.waitForPause(); - final int breakLine = (await flutter.getSourceLocation()).line; + final int? breakLine = (await flutter.getSourceLocation())?.line; expect(breakLine, project.lineContaining(project.test, "throw 'rebuild';")); }); } @@ -726,8 +724,8 @@ class TestProject extends Project { TestProject(this.testBody, { this.setup, this.classes }); final String testBody; - final String setup; - final String classes; + final String? setup; + final String? classes; @override final String pubspec = ''' diff --git a/packages/flutter_tools/test/integration.shard/test_data/background_project.dart b/packages/flutter_tools/test/integration.shard/test_data/background_project.dart index 68b9674460..13e37f1ea0 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/background_project.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/background_project.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 '../test_utils.dart'; import 'project.dart'; diff --git a/packages/flutter_tools/test/integration.shard/test_data/basic_project.dart b/packages/flutter_tools/test/integration.shard/test_data/basic_project.dart index 5f50114692..0090d69003 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/basic_project.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/basic_project.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 'project.dart'; class BasicProject extends Project { diff --git a/packages/flutter_tools/test/integration.shard/test_data/deferred_components_project.dart b/packages/flutter_tools/test/integration.shard/test_data/deferred_components_project.dart index ec746a9221..a51b332cca 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/deferred_components_project.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/deferred_components_project.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 '../../src/common.dart'; import 'deferred_components_config.dart'; import 'project.dart'; @@ -84,7 +82,7 @@ class BasicDeferredComponentsConfig extends DeferredComponentsConfig { '''; @override - String get deferredComponentsGolden => r''' + String? get deferredComponentsGolden => r''' loading-units: - id: 2 libraries: @@ -604,7 +602,7 @@ class NoAndroidDynamicFeatureModuleDeferredComponentsConfig extends BasicDeferre /// Missing golden class NoGoldenDeferredComponentsConfig extends BasicDeferredComponentsConfig { @override - String get deferredComponentsGolden => null; + String? get deferredComponentsGolden => null; } /// Missing golden diff --git a/packages/flutter_tools/test/integration.shard/test_data/gen_l10n_project.dart b/packages/flutter_tools/test/integration.shard/test_data/gen_l10n_project.dart index d82ea93195..55531ac564 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/gen_l10n_project.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/gen_l10n_project.dart @@ -2,10 +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:file/file.dart'; -import 'package:meta/meta.dart'; import '../test_utils.dart'; import 'project.dart'; @@ -750,8 +747,8 @@ void main() { '''; String l10nYaml({ - @required bool useDeferredLoading, - @required bool useSyntheticPackage, + required bool useDeferredLoading, + required bool useSyntheticPackage, }) { String l10nYamlString = ''; diff --git a/packages/flutter_tools/test/integration.shard/test_data/hot_reload_const_project.dart b/packages/flutter_tools/test/integration.shard/test_data/hot_reload_const_project.dart index 1c096af91e..0a2a1456ac 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/hot_reload_const_project.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/hot_reload_const_project.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 '../test_utils.dart'; import 'project.dart'; diff --git a/packages/flutter_tools/test/integration.shard/test_data/hot_reload_project.dart b/packages/flutter_tools/test/integration.shard/test_data/hot_reload_project.dart index 584fd04491..c0f5e2b76f 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/hot_reload_project.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/hot_reload_project.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 '../test_utils.dart'; import 'project.dart'; diff --git a/packages/flutter_tools/test/integration.shard/test_data/hot_reload_with_asset.dart b/packages/flutter_tools/test/integration.shard/test_data/hot_reload_with_asset.dart index a7244b6faa..a4111ed4b4 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/hot_reload_with_asset.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/hot_reload_with_asset.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 '../test_utils.dart'; import 'project.dart'; diff --git a/packages/flutter_tools/test/integration.shard/test_data/multidex_project.dart b/packages/flutter_tools/test/integration.shard/test_data/multidex_project.dart index 70fdf0d231..3bd3f82662 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/multidex_project.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/multidex_project.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/test_data/project.dart b/packages/flutter_tools/test/integration.shard/test_data/project.dart index 47d299bc13..69be0b6d42 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/project.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/project.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 '../test_utils.dart'; @@ -21,31 +19,32 @@ const String _kDefaultHtml = ''' '''; abstract class Project { - Directory dir; + late Directory dir; String get pubspec; - String get main; - String get test => null; - String get generatedFile => null; - DeferredComponentsConfig get deferredComponents => null; + String? get main => null; + String? get test => null; + String? get generatedFile => null; + DeferredComponentsConfig? get deferredComponents => null; Uri get mainDart => Uri.parse('package:test/main.dart'); Future setUpIn(Directory dir) async { this.dir = dir; writeFile(fileSystem.path.join(dir.path, 'pubspec.yaml'), pubspec); + final String? main = this.main; if (main != null) { writeFile(fileSystem.path.join(dir.path, 'lib', 'main.dart'), main); } + final String? test = this.test; if (test != null) { writeFile(fileSystem.path.join(dir.path, 'test', 'test.dart'), test); } + final String? generatedFile = this.generatedFile; if (generatedFile != null) { writeFile(fileSystem.path.join(dir.path, '.dart_tool', 'flutter_gen', 'flutter_gen.dart'), generatedFile); } - if (deferredComponents != null) { - deferredComponents.setUpIn(dir); - } + deferredComponents?.setUpIn(dir); writeFile(fileSystem.path.join(dir.path, 'web', 'index.html'), _kDefaultHtml); writePackages(dir.path); await getPackages(dir.path); diff --git a/packages/flutter_tools/test/integration.shard/test_data/project_with_early_error.dart b/packages/flutter_tools/test/integration.shard/test_data/project_with_early_error.dart index 819d56cac6..10dc33e2bf 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/project_with_early_error.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/project_with_early_error.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 'project.dart'; class ProjectWithEarlyError extends Project { diff --git a/packages/flutter_tools/test/integration.shard/test_data/single_widget_reload_project.dart b/packages/flutter_tools/test/integration.shard/test_data/single_widget_reload_project.dart index 488958a155..083a0c04d3 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/single_widget_reload_project.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/single_widget_reload_project.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 '../test_utils.dart'; import 'project.dart'; diff --git a/packages/flutter_tools/test/integration.shard/test_data/stateless_stateful_project.dart b/packages/flutter_tools/test/integration.shard/test_data/stateless_stateful_project.dart index 20430df397..5d89cb914e 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/stateless_stateful_project.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/stateless_stateful_project.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 '../test_utils.dart'; import 'project.dart'; diff --git a/packages/flutter_tools/test/integration.shard/test_data/stepping_project.dart b/packages/flutter_tools/test/integration.shard/test_data/stepping_project.dart index 5722a70c0a..f9161dc5bd 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/stepping_project.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/stepping_project.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 'project.dart'; class SteppingProject extends Project { diff --git a/packages/flutter_tools/test/integration.shard/test_data/test_project.dart b/packages/flutter_tools/test/integration.shard/test_data/test_project.dart index 6253e04617..279747afdc 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/test_project.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/test_project.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 'project.dart'; class TestProject extends Project { diff --git a/packages/flutter_tools/test/integration.shard/test_data/tests_project.dart b/packages/flutter_tools/test/integration.shard/test_data/tests_project.dart index c29c417b47..c567d6a899 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/tests_project.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/tests_project.dart @@ -2,9 +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';