diff --git a/packages/flutter_tools/lib/src/dart/language_version.dart b/packages/flutter_tools/lib/src/dart/language_version.dart index 0bea7a3a2c..311ce2e992 100644 --- a/packages/flutter_tools/lib/src/dart/language_version.dart +++ b/packages/flutter_tools/lib/src/dart/language_version.dart @@ -48,7 +48,7 @@ bool _inUnitTest() { /// /// The specification for the language version tag is defined at: /// https://github.com/dart-lang/language/blob/master/accepted/future-releases/language-versioning/feature-specification.md#individual-library-language-version-override -LanguageVersion determineLanguageVersion(File file, Package package, String flutterRoot) { +LanguageVersion determineLanguageVersion(File file, Package? package, String flutterRoot) { int blockCommentDepth = 0; // If reading the file fails, default to a null-safe version. The // command will likely fail later in the process with a better error diff --git a/packages/flutter_tools/test/commands.shard/hermetic/proxy_validator_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/proxy_validator_test.dart index 3cdc30aff9..c3da3a174f 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/proxy_validator_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/proxy_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:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/doctor_validator.dart'; import 'package:flutter_tools/src/proxy_validator.dart'; diff --git a/packages/flutter_tools/test/general.shard/android/build_validation_test.dart b/packages/flutter_tools/test/general.shard/android/build_validation_test.dart index 6f90ce091d..886662379f 100644 --- a/packages/flutter_tools/test/general.shard/android/build_validation_test.dart +++ b/packages/flutter_tools/test/general.shard/android/build_validation_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/android/build_validation.dart'; import 'package:flutter_tools/src/build_info.dart'; diff --git a/packages/flutter_tools/test/general.shard/build_info_test.dart b/packages/flutter_tools/test/general.shard/build_info_test.dart index 64b8bda1af..aff87f9e27 100644 --- a/packages/flutter_tools/test/general.shard/build_info_test.dart +++ b/packages/flutter_tools/test/general.shard/build_info_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:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/build_info.dart'; import '../src/common.dart'; void main() { - BufferLogger logger; + late BufferLogger logger; setUp(() { logger = BufferLogger.test(); }); group('Validate build number', () { testWithoutContext('CFBundleVersion for iOS', () async { - String buildName = validatedBuildNumberForPlatform(TargetPlatform.ios, 'xyz', logger); + String? buildName = validatedBuildNumberForPlatform(TargetPlatform.ios, 'xyz', logger); expect(buildName, isNull); buildName = validatedBuildNumberForPlatform(TargetPlatform.ios, '0.0.1', logger); expect(buildName, '0.0.1'); @@ -29,7 +26,7 @@ void main() { }); testWithoutContext('versionCode for Android', () async { - String buildName = validatedBuildNumberForPlatform(TargetPlatform.android_arm, '123.abc+-', logger); + String? buildName = validatedBuildNumberForPlatform(TargetPlatform.android_arm, '123.abc+-', logger); expect(buildName, '123'); buildName = validatedBuildNumberForPlatform(TargetPlatform.android_arm, 'abc', logger); expect(buildName, '1'); @@ -38,7 +35,7 @@ void main() { group('Validate build name', () { testWithoutContext('CFBundleShortVersionString for iOS', () async { - String buildName = validatedBuildNameForPlatform(TargetPlatform.ios, 'xyz', logger); + String? buildName = validatedBuildNameForPlatform(TargetPlatform.ios, 'xyz', logger); expect(buildName, isNull); buildName = validatedBuildNameForPlatform(TargetPlatform.ios, '0.0.1', logger); expect(buildName, '0.0.1'); @@ -52,7 +49,7 @@ void main() { }); testWithoutContext('versionName for Android', () async { - String buildName = validatedBuildNameForPlatform(TargetPlatform.android_arm, '123.abc+-', logger); + String? buildName = validatedBuildNameForPlatform(TargetPlatform.android_arm, '123.abc+-', logger); expect(buildName, '123.abc+-'); buildName = validatedBuildNameForPlatform(TargetPlatform.android_arm, 'abc+-', logger); expect(buildName, 'abc+-'); diff --git a/packages/flutter_tools/test/general.shard/build_system/depfile_test.dart b/packages/flutter_tools/test/general.shard/build_system/depfile_test.dart index e4ea27535e..69d3e3d0d6 100644 --- a/packages/flutter_tools/test/general.shard/build_system/depfile_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/depfile_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'; @@ -12,8 +10,8 @@ import 'package:flutter_tools/src/build_system/depfile.dart'; import '../../src/common.dart'; void main() { - FileSystem fileSystem; - DepfileService depfileService; + late FileSystem fileSystem; + late DepfileService depfileService; setUp(() { fileSystem = MemoryFileSystem.test(); diff --git a/packages/flutter_tools/test/general.shard/common_test.dart b/packages/flutter_tools/test/general.shard/common_test.dart index bfe7e4785f..0507aecd86 100644 --- a/packages/flutter_tools/test/general.shard/common_test.dart +++ b/packages/flutter_tools/test/general.shard/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 '../src/common.dart'; void main() { diff --git a/packages/flutter_tools/test/general.shard/dart/language_version_test.dart b/packages/flutter_tools/test/general.shard/dart/language_version_test.dart index fc5e2dc2e3..0d5f25a984 100644 --- a/packages/flutter_tools/test/general.shard/dart/language_version_test.dart +++ b/packages/flutter_tools/test/general.shard/dart/language_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 'package:file/memory.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/dart/language_version.dart'; diff --git a/packages/flutter_tools/test/general.shard/flutter_project_metadata_test.dart b/packages/flutter_tools/test/general.shard/flutter_project_metadata_test.dart index 24981dd9a1..1473b6e6c7 100644 --- a/packages/flutter_tools/test/general.shard/flutter_project_metadata_test.dart +++ b/packages/flutter_tools/test/general.shard/flutter_project_metadata_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/flutter_project_metadata.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; @@ -12,9 +10,9 @@ import 'package:file/memory.dart'; import '../src/common.dart'; void main() { - FileSystem fileSystem; - BufferLogger logger; - File metadataFile; + late FileSystem fileSystem; + late BufferLogger logger; + late File metadataFile; setUp(() { fileSystem = MemoryFileSystem.test(); diff --git a/packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart b/packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart index cb2aa6423f..ae06c92bca 100644 --- a/packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart +++ b/packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_tools/src/doctor_validator.dart'; import 'package:flutter_tools/src/linux/linux_doctor.dart'; import '../../src/common.dart'; -import '../../src/context.dart'; +import '../../src/fake_process_manager.dart'; // A command that will return typical-looking 'clang++ --version' output with // the given version number. diff --git a/packages/flutter_tools/test/general.shard/test/event_printer_test.dart b/packages/flutter_tools/test/general.shard/test/event_printer_test.dart index f746dbaff6..52942037e6 100644 --- a/packages/flutter_tools/test/general.shard/test/event_printer_test.dart +++ b/packages/flutter_tools/test/general.shard/test/event_printer_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/event_printer.dart'; import 'package:flutter_tools/src/test/test_device.dart'; import 'package:test/fake.dart'; @@ -13,8 +11,8 @@ import '../../src/common.dart'; void main() { group(EventPrinter, () { final Uri observatoryUri = Uri.parse('http://localhost:1234'); - EventPrinter eventPrinter; - StringBuffer output; + late EventPrinter eventPrinter; + late StringBuffer output; setUp(() { output = StringBuffer(); diff --git a/packages/flutter_tools/test/general.shard/time_test.dart b/packages/flutter_tools/test/general.shard/time_test.dart index 184b1ba094..e1d707bc70 100644 --- a/packages/flutter_tools/test/general.shard/time_test.dart +++ b/packages/flutter_tools/test/general.shard/time_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/time.dart'; import '../src/common.dart'; @@ -29,9 +27,9 @@ void main() { final String formattedTime = formatDateTime(time); // If a date time string has a timezone offset, DateTime.tryParse() // converts the parsed time to UTC. - final DateTime parsedTime = DateTime.tryParse(formattedTime); + final DateTime? parsedTime = DateTime.tryParse(formattedTime); expect(parsedTime, isNotNull); - expect(parsedTime.isUtc, isTrue); + expect(parsedTime!.isUtc, isTrue); // Convert the parsed time (which should be utc) to the local timezone and // compare against the original time which is in the local timezone. They // should be the same. diff --git a/packages/flutter_tools/test/general.shard/utils_test.dart b/packages/flutter_tools/test/general.shard/utils_test.dart index ae5ef7f822..b7d779eaea 100644 --- a/packages/flutter_tools/test/general.shard/utils_test.dart +++ b/packages/flutter_tools/test/general.shard/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:flutter_tools/src/base/utils.dart'; import 'package:flutter_tools/src/base/version.dart'; import 'package:flutter_tools/src/base/terminal.dart'; @@ -29,24 +27,24 @@ baz=qux expect(Version.unknown.toString(), equals('unknown')); expect(Version(null, null, null).toString(), equals('0')); - final Version v1 = Version.parse('1'); + final Version v1 = Version.parse('1')!; expect(v1.major, equals(1)); expect(v1.minor, equals(0)); expect(v1.patch, equals(0)); expect(v1, greaterThan(Version.unknown)); - final Version v2 = Version.parse('1.2'); + final Version v2 = Version.parse('1.2')!; expect(v2.major, equals(1)); expect(v2.minor, equals(2)); expect(v2.patch, equals(0)); - final Version v3 = Version.parse('1.2.3'); + final Version v3 = Version.parse('1.2.3')!; expect(v3.major, equals(1)); expect(v3.minor, equals(2)); expect(v3.patch, equals(3)); - final Version v4 = Version.parse('1.12'); + final Version v4 = Version.parse('1.12')!; expect(v4, greaterThan(v2)); expect(v3, greaterThan(v2)); diff --git a/packages/flutter_tools/test/general.shard/vscode/vscode_test.dart b/packages/flutter_tools/test/general.shard/vscode/vscode_test.dart index f3c141f6b2..e43b72030c 100644 --- a/packages/flutter_tools/test/general.shard/vscode/vscode_test.dart +++ b/packages/flutter_tools/test/general.shard/vscode/vscode_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/version.dart'; import 'package:flutter_tools/src/vscode/vscode.dart'; diff --git a/packages/flutter_tools/test/general.shard/windows/visual_studio_test.dart b/packages/flutter_tools/test/general.shard/windows/visual_studio_test.dart index d8e8c88bc9..f60dc1c041 100644 --- a/packages/flutter_tools/test/general.shard/windows/visual_studio_test.dart +++ b/packages/flutter_tools/test/general.shard/windows/visual_studio_test.dart @@ -13,7 +13,7 @@ import 'package:flutter_tools/src/convert.dart'; import 'package:flutter_tools/src/windows/visual_studio.dart'; import '../../src/common.dart'; -import '../../src/context.dart'; +import '../../src/fake_process_manager.dart'; const String programFilesPath = r'C:\Program Files (x86)'; const String visualStudioPath = programFilesPath + r'\Microsoft Visual Studio\2017\Community';