diff --git a/test/code_segments_test.dart b/test/code_segments_test.dart index bf97861a1e..0645da4845 100644 --- a/test/code_segments_test.dart +++ b/test/code_segments_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.9 - import 'package:test/test.dart'; import '../tool/codeviewer_cli/segment_generator.dart'; diff --git a/test/demo_descriptions_test.dart b/test/demo_descriptions_test.dart index 854dbf1a66..b9f4e61694 100644 --- a/test/demo_descriptions_test.dart +++ b/test/demo_descriptions_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.9 - import 'package:collection/collection.dart'; import 'package:flutter_gen/gen_l10n/gallery_localizations_en.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/test/l10n_test.dart b/test/l10n_test.dart index 66066f607f..f17a71ab33 100644 --- a/test/l10n_test.dart +++ b/test/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.9 - import 'package:test/test.dart'; import '../tool/l10n_cli/l10n_cli.dart'; diff --git a/test/pages/home_test.dart b/test/pages/home_test.dart index 04b668874e..778f08da65 100644 --- a/test/pages/home_test.dart +++ b/test/pages/home_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.9 - import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/gallery_localizations.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/test/restoration_test.dart b/test/restoration_test.dart index 20edcabc5c..34970c6940 100644 --- a/test/restoration_test.dart +++ b/test/restoration_test.dart @@ -1,5 +1,3 @@ -// @dart=2.9 - import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:gallery/data/demos.dart'; diff --git a/test/utils.dart b/test/utils.dart index 80a932f869..d6c90e4934 100644 --- a/test/utils.dart +++ b/test/utils.dart @@ -2,7 +2,5 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart=2.9 - // Replace Windows line endings with Unix line endings String standardizeLineEndings(String str) => str.replaceAll('\r\n', '\n'); diff --git a/test/widget_test.dart b/test/widget_test.dart index 4fd9f94d71..5a87de6970 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -2,6 +2,4 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart=2.9 - void main() {} diff --git a/test_driver/transitions_perf.dart b/test_driver/transitions_perf.dart index 19841503dd..e9a9130e01 100644 --- a/test_driver/transitions_perf.dart +++ b/test_driver/transitions_perf.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.9 - import 'dart:async'; import 'dart:convert' show JsonEncoder; @@ -14,7 +12,7 @@ import 'package:gallery/main.dart' show GalleryApp; // See transitions_perf_test.dart for how to run this test. -Future _handleMessages(String message) async { +Future _handleMessages(String? message) async { switch (message) { case 'demoDescriptions': final demoDescriptions = allGalleryDemoDescriptions(); diff --git a/test_driver/transitions_perf_test.dart b/test_driver/transitions_perf_test.dart index 8c0c8c6c29..a0eb235e30 100644 --- a/test_driver/transitions_perf_test.dart +++ b/test_driver/transitions_perf_test.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.9 - -import 'dart:async'; import 'dart:convert' show json; import 'dart:io' show sleep, stdout; @@ -131,12 +128,12 @@ Future isPresent(SerializableFinder finder, FlutterDriver driver, Future runDemos( List demos, FlutterDriver driver, { - Future Function() additionalActions, + Future Function()? additionalActions, bool scrollToTopWhenDone = true, }) async { - String currentDemoCategory; - SerializableFinder demoList; - SerializableFinder demoItem; + String? currentDemoCategory; + late SerializableFinder demoList; + SerializableFinder? demoItem; for (final demo in demos) { if (_skippedDemos.contains(demo)) continue; @@ -199,15 +196,15 @@ Future runDemos( stdout.writeln('< Success'); } - if (scrollToTopWhenDone) await scrollToTop(demoItem, driver); + if (scrollToTopWhenDone) await scrollToTop(demoItem!, driver); } void main([List args = const []]) { group('Flutter Gallery transitions', () { - FlutterDriver driver; + late FlutterDriver driver; - bool isTestingCraneOnly; - bool isTestingReplyOnly; + late bool isTestingCraneOnly; + late bool isTestingReplyOnly; setUpAll(() async { driver = await FlutterDriver.connect(); @@ -235,9 +232,7 @@ void main([List args = const []]) { }); tearDownAll(() async { - if (driver != null) { - await driver.close(); - } + await driver.close(); stdout.writeln( 'Timeline summaries for profiled demos have been output to the build/ directory.'); diff --git a/test_goldens/demo_test.dart b/test_goldens/demo_test.dart index 53e2232164..5ef0a626ff 100644 --- a/test_goldens/demo_test.dart +++ b/test_goldens/demo_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.9 - import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/test_goldens/flutter_test_config.dart b/test_goldens/flutter_test_config.dart index 46fb3c97e4..36634ff3e9 100644 --- a/test_goldens/flutter_test_config.dart +++ b/test_goldens/flutter_test_config.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.9 - import 'dart:async'; import 'dart:io'; diff --git a/test_goldens/home_test.dart b/test_goldens/home_test.dart index 0df37e6275..470b58ad96 100644 --- a/test_goldens/home_test.dart +++ b/test_goldens/home_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.9 - import 'package:flutter/cupertino.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/test_goldens/testing/font_loader.dart b/test_goldens/testing/font_loader.dart index 1293223667..44bae1b487 100644 --- a/test_goldens/testing/font_loader.dart +++ b/test_goldens/testing/font_loader.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.9 - import 'dart:convert'; import 'dart:io'; @@ -20,15 +18,17 @@ Future loadFonts() async { ..addAll(loadFontsFromTestingDir())); } -Future>>> loadFontsFromManifest() async { - final fontManifest = await rootBundle.loadStructuredData>( +Future>>> loadFontsFromManifest() async { + final List fontManifest = + await (rootBundle.loadStructuredData>( 'FontManifest.json', - (data) async => json.decode(data) as Iterable, - ); - final fontFamilyToData = >>{}; + (data) async => json.decode(data) as List, + )); + + final fontFamilyToData = >>{}; for (final fontData in fontManifest) { - final fontFamily = fontData['family'] as String; - final fonts = fontData['fonts'] as Iterable; + final fontFamily = fontData['family'] as String?; + final fonts = fontData['fonts'] as List; for (final font in fonts) { (fontFamilyToData[fontFamily] ??= []) .add(rootBundle.load(font['asset'] as String)); @@ -77,10 +77,11 @@ Map>> loadGoogleFonts() { return fontFamilyToData; } -Future _load(Map>> fontFamilyToData) async { +Future _load( + Map>> fontFamilyToData) async { final waitList = >[]; for (final entry in fontFamilyToData.entries) { - final loader = FontLoader(entry.key); + final loader = FontLoader(entry.key!); for (final data in entry.value) { loader.addFont(data); } diff --git a/test_goldens/testing/precache_images.dart b/test_goldens/testing/precache_images.dart index 58a1feffbc..2f53db064f 100644 --- a/test_goldens/testing/precache_images.dart +++ b/test_goldens/testing/precache_images.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.9 - import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -13,7 +11,7 @@ Future pumpWidgetWithImages( Widget widget, List assetNames, ) async { - Future precacheFuture; + Future? precacheFuture; await tester.pumpWidget( Builder(builder: (buildContext) { precacheFuture = tester.runAsync(() async { diff --git a/test_goldens/testing/util.dart b/test_goldens/testing/util.dart index 059b0c61d4..36b6db0bf1 100644 --- a/test_goldens/testing/util.dart +++ b/test_goldens/testing/util.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.9 - import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart';