diff --git a/packages/flutter_tools/lib/src/ios/code_signing.dart b/packages/flutter_tools/lib/src/ios/code_signing.dart index 96dc40fb2f..2f70d4d994 100644 --- a/packages/flutter_tools/lib/src/ios/code_signing.dart +++ b/packages/flutter_tools/lib/src/ios/code_signing.dart @@ -187,7 +187,7 @@ Future?> getCodeSigningIdentityDevelopmentTeam({ final String opensslOutput = await utf8.decodeStream(opensslProcess.stdout); // Fire and forget discard of the stderr stream so we don't hold onto resources. // Don't care about the result. - unawaited(opensslProcess.stderr.drain()); + unawaited(opensslProcess.stderr.drain()); if (await opensslProcess.exitCode != 0) { return null; diff --git a/packages/flutter_tools/test/general.shard/base/error_handling_io_test.dart b/packages/flutter_tools/test/general.shard/base/error_handling_io_test.dart index b2b3a7f686..652499d008 100644 --- a/packages/flutter_tools/test/general.shard/base/error_handling_io_test.dart +++ b/packages/flutter_tools/test/general.shard/base/error_handling_io_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; // flutter_ignore: dart_io_import; import 'package:file/file.dart'; @@ -103,7 +101,7 @@ void main() { const int kUserPermissionDenied = 5; const int kFatalDeviceHardwareError = 483; - FileExceptionHandler exceptionHandler; + late FileExceptionHandler exceptionHandler; setUp(() { exceptionHandler = FileExceptionHandler(); @@ -340,7 +338,7 @@ void main() { testWithoutContext('When reading from a file or directory without permission', () { final ErrorHandlingFileSystem fileSystem = ErrorHandlingFileSystem( - delegate: ThrowsOnCurrentDirectoryFileSystem()..errorCode = kUserPermissionDenied, + delegate: ThrowsOnCurrentDirectoryFileSystem(kUserPermissionDenied), platform: windowsPlatform, ); @@ -354,7 +352,7 @@ void main() { const int enospc = 28; const int eacces = 13; - FileExceptionHandler exceptionHandler; + late FileExceptionHandler exceptionHandler; setUp(() { exceptionHandler = FileExceptionHandler(); @@ -531,7 +529,7 @@ void main() { testWithoutContext('When the current working directory disappears', () async { final ErrorHandlingFileSystem fileSystem = ErrorHandlingFileSystem( - delegate: ThrowsOnCurrentDirectoryFileSystem()..errorCode = kSystemCannotFindFile, + delegate: ThrowsOnCurrentDirectoryFileSystem(kSystemCannotFindFile), platform: linuxPlatform, ); @@ -560,7 +558,7 @@ void main() { const int eperm = 1; const int enospc = 28; const int eacces = 13; - FileExceptionHandler exceptionHandler; + late FileExceptionHandler exceptionHandler; setUp(() { exceptionHandler = FileExceptionHandler(); @@ -754,7 +752,7 @@ void main() { testWithoutContext('When reading from current directory without permission', () { final ErrorHandlingFileSystem fileSystem = ErrorHandlingFileSystem( - delegate: ThrowsOnCurrentDirectoryFileSystem()..errorCode = eacces, + delegate: ThrowsOnCurrentDirectoryFileSystem(eacces), platform: linuxPlatform, ); @@ -781,11 +779,9 @@ void main() { ); final Object firstPath = fs.path; + expect(firstPath, isNotNull); fs.currentDirectory = null; - // For fs.path.absolute usage. - fileSystem.path = MemoryFileSystem.test().path; - expect(identical(firstPath, fs.path), false); }); @@ -1089,8 +1085,8 @@ void main() { group('CopySync' , () { const int eaccess = 13; - FileExceptionHandler exceptionHandler; - ErrorHandlingFileSystem fileSystem; + late FileExceptionHandler exceptionHandler; + late ErrorHandlingFileSystem fileSystem; setUp(() { exceptionHandler = FileExceptionHandler(); @@ -1191,20 +1187,22 @@ class ThrowingFakeProcessManager extends Fake implements ProcessManager { final Exception _exception; @override - bool canRun(dynamic executable, {String workingDirectory}) { + bool canRun(dynamic executable, {String? workingDirectory}) { throw _exception; } } class ThrowsOnCurrentDirectoryFileSystem extends Fake implements FileSystem { - int errorCode; + ThrowsOnCurrentDirectoryFileSystem(this.errorCode); + + final int errorCode; @override Directory get currentDirectory => throw FileSystemException('', '', OSError('', errorCode)); } class FakeExistsFile extends Fake implements File { - Object error; + late Object error; int existsCount = 0; @@ -1225,10 +1223,7 @@ class FakeExistsFile extends Fake implements File { class FakeFileSystem extends Fake implements FileSystem { @override - p.Context path; - - @override - Directory get currentDirectory => null; + p.Context get path => p.Context(); @override set currentDirectory(dynamic path) { } diff --git a/packages/flutter_tools/test/general.shard/base/process_test.dart b/packages/flutter_tools/test/general.shard/base/process_test.dart index e2f276116c..22b2b38669 100644 --- a/packages/flutter_tools/test/general.shard/base/process_test.dart +++ b/packages/flutter_tools/test/general.shard/base/process_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 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/platform.dart'; @@ -16,8 +14,8 @@ import '../../src/fakes.dart'; void main() { group('process exceptions', () { - FakeProcessManager fakeProcessManager; - ProcessUtils processUtils; + late FakeProcessManager fakeProcessManager; + late ProcessUtils processUtils; setUp(() { fakeProcessManager = FakeProcessManager.empty(); @@ -42,7 +40,7 @@ void main() { group('shutdownHooks', () { testWithoutContext('runInExpectedOrder', () async { int i = 1; - int cleanup; + int? cleanup; final ShutdownHooks shutdownHooks = ShutdownHooks(logger: BufferLogger.test()); @@ -57,9 +55,9 @@ void main() { }); group('output formatting', () { - FakeProcessManager processManager; - ProcessUtils processUtils; - BufferLogger logger; + late FakeProcessManager processManager; + late ProcessUtils processUtils; + late BufferLogger logger; setUp(() { processManager = FakeProcessManager.empty(); @@ -104,8 +102,8 @@ void main() { }); group('run', () { - FakeProcessManager fakeProcessManager; - ProcessUtils processUtils; + late FakeProcessManager fakeProcessManager; + late ProcessUtils processUtils; setUp(() { fakeProcessManager = FakeProcessManager.empty(); @@ -180,9 +178,9 @@ void main() { }); group('runSync', () { - FakeProcessManager fakeProcessManager; - ProcessUtils processUtils; - BufferLogger testLogger; + late FakeProcessManager fakeProcessManager; + late ProcessUtils processUtils; + late BufferLogger testLogger; setUp(() { fakeProcessManager = FakeProcessManager.empty(); @@ -331,8 +329,8 @@ void main() { }); group('exitsHappySync', () { - FakeProcessManager processManager; - ProcessUtils processUtils; + late FakeProcessManager processManager; + late ProcessUtils processUtils; setUp(() { processManager = FakeProcessManager.empty(); @@ -388,8 +386,8 @@ void main() { }); group('exitsHappy', () { - FakeProcessManager processManager; - ProcessUtils processUtils; + late FakeProcessManager processManager; + late ProcessUtils processUtils; setUp(() { processManager = FakeProcessManager.empty(); diff --git a/packages/flutter_tools/test/general.shard/build_system/invalidated_reason_test.dart b/packages/flutter_tools/test/general.shard/build_system/invalidated_reason_test.dart index 312ea8f8c2..537ad73487 100644 --- a/packages/flutter_tools/test/general.shard/build_system/invalidated_reason_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/invalidated_reason_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/build_system/build_system.dart'; import '../../src/common.dart'; diff --git a/packages/flutter_tools/test/general.shard/commands/flutter_root_test.dart b/packages/flutter_tools/test/general.shard/commands/flutter_root_test.dart index 203377a89f..5a44537f3e 100644 --- a/packages/flutter_tools/test/general.shard/commands/flutter_root_test.dart +++ b/packages/flutter_tools/test/general.shard/commands/flutter_root_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/platform.dart'; diff --git a/packages/flutter_tools/test/general.shard/custom_devices/custom_devices_config_test.dart b/packages/flutter_tools/test/general.shard/custom_devices/custom_devices_config_test.dart index 8095c3d39e..ee9000b861 100644 --- a/packages/flutter_tools/test/general.shard/custom_devices/custom_devices_config_test.dart +++ b/packages/flutter_tools/test/general.shard/custom_devices/custom_devices_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/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/dart/generate_synthetic_packages_test.dart b/packages/flutter_tools/test/general.shard/dart/generate_synthetic_packages_test.dart index e086e17132..2ec44bb43d 100644 --- a/packages/flutter_tools/test/general.shard/dart/generate_synthetic_packages_test.dart +++ b/packages/flutter_tools/test/general.shard/dart/generate_synthetic_packages_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. - import 'dart:async'; import 'package:file/memory.dart'; diff --git a/packages/flutter_tools/test/general.shard/ios/code_signing_test.dart b/packages/flutter_tools/test/general.shard/ios/code_signing_test.dart index 33746b3e19..5d8980894a 100644 --- a/packages/flutter_tools/test/general.shard/ios/code_signing_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/code_signing_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'; @@ -25,9 +23,9 @@ const String kCertificates = ''' void main() { group('Auto signing', () { - Config testConfig; - AnsiTerminal testTerminal; - BufferLogger logger; + late Config testConfig; + late AnsiTerminal testTerminal; + late BufferLogger logger; setUp(() async { logger = BufferLogger.test(); @@ -37,7 +35,7 @@ void main() { }); testWithoutContext('No auto-sign if Xcode project settings are not available', () async { - final Map signingConfigs = await getCodeSigningIdentityDevelopmentTeam( + final Map? signingConfigs = await getCodeSigningIdentityDevelopmentTeam( buildSettings: null, processManager: FakeProcessManager.empty(), logger: logger, @@ -48,7 +46,7 @@ void main() { }); testWithoutContext('No discovery if development team specified in Xcode project', () async { - final Map signingConfigs = await getCodeSigningIdentityDevelopmentTeam( + final Map? signingConfigs = await getCodeSigningIdentityDevelopmentTeam( buildSettings: { 'DEVELOPMENT_TEAM': 'abc', }, @@ -71,7 +69,7 @@ void main() { ), ]); - final Map signingConfigs = await getCodeSigningIdentityDevelopmentTeam( + final Map? signingConfigs = await getCodeSigningIdentityDevelopmentTeam( buildSettings: { 'bogus': 'bogus', }, @@ -135,13 +133,13 @@ void main() { ]); // Verify that certifacte value is passed into openssl command. - String stdin; + String? stdin; controller.stream.listen((List chunk) { stdin = utf8.decode(chunk); completer.complete(); }); - final Map signingConfigs = await getCodeSigningIdentityDevelopmentTeam( + final Map? signingConfigs = await getCodeSigningIdentityDevelopmentTeam( buildSettings: { 'bogus': 'bogus', }, @@ -187,13 +185,13 @@ void main() { ]); // Verify that certifacte value is passed into openssl command. - String stdin; + String? stdin; controller.stream.listen((List chunk) { stdin = utf8.decode(chunk); completer.complete(); }); - final Map signingConfigs = await getCodeSigningIdentityDevelopmentTeam( + final Map? signingConfigs = await getCodeSigningIdentityDevelopmentTeam( buildSettings: { 'bogus': 'bogus', }, @@ -237,13 +235,13 @@ void main() { ]); // Verify that certifacte value is passed into openssl command. - String stdin; + String? stdin; controller.stream.listen((List chunk) { stdin = utf8.decode(chunk); completer.complete(); }); - final Map signingConfigs = await getCodeSigningIdentityDevelopmentTeam( + final Map? signingConfigs = await getCodeSigningIdentityDevelopmentTeam( buildSettings: { 'bogus': 'bogus', }, @@ -295,13 +293,13 @@ void main() { ]); // Verify that certifacte value is passed into openssl command. - String stdin; + String? stdin; controller.stream.listen((List chunk) { stdin = utf8.decode(chunk); completer.complete(); }); - final Map signingConfigs = await getCodeSigningIdentityDevelopmentTeam( + final Map? signingConfigs = await getCodeSigningIdentityDevelopmentTeam( buildSettings: { 'bogus': 'bogus', }, @@ -348,13 +346,13 @@ void main() { ]); // Verify that certifacte value is passed into openssl command. - String stdin; + String? stdin; controller.stream.listen((List chunk) { stdin = utf8.decode(chunk); completer.complete(); }); - final Map signingConfigs = await getCodeSigningIdentityDevelopmentTeam( + final Map? signingConfigs = await getCodeSigningIdentityDevelopmentTeam( buildSettings: { 'bogus': 'bogus', }, @@ -406,13 +404,13 @@ void main() { ]); // Verify that certifacte value is passed into openssl command. - String stdin; + String? stdin; controller.stream.listen((List chunk) { stdin = utf8.decode(chunk); completer.complete(); }); - final Map signingConfigs = await getCodeSigningIdentityDevelopmentTeam( + final Map? signingConfigs = await getCodeSigningIdentityDevelopmentTeam( buildSettings: { 'bogus': 'bogus', }, @@ -449,7 +447,7 @@ void main() { ), ]); - final Map signingConfigs = await getCodeSigningIdentityDevelopmentTeam( + final Map? signingConfigs = await getCodeSigningIdentityDevelopmentTeam( buildSettings: { 'bogus': 'bogus', }, @@ -481,7 +479,7 @@ void main() { ), ]); - final Map signingConfigs = await getCodeSigningIdentityDevelopmentTeam( + final Map? signingConfigs = await getCodeSigningIdentityDevelopmentTeam( buildSettings: { 'bogus': 'bogus', }, @@ -495,7 +493,7 @@ void main() { }); } -Stream mockTerminalStdInStream; +late Stream mockTerminalStdInStream; class TestTerminal extends AnsiTerminal { TestTerminal() : super(stdio: globals.stdio, platform: globals.platform); diff --git a/packages/flutter_tools/test/general.shard/macos/macos_workflow_test.dart b/packages/flutter_tools/test/general.shard/macos/macos_workflow_test.dart index 5a43678397..bf323e018b 100644 --- a/packages/flutter_tools/test/general.shard/macos/macos_workflow_test.dart +++ b/packages/flutter_tools/test/general.shard/macos/macos_workflow_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/macos/macos_workflow.dart'; diff --git a/packages/flutter_tools/test/general.shard/windows/plugins_test.dart b/packages/flutter_tools/test/general.shard/windows/plugins_test.dart index 0b3ca10b90..68337306a2 100644 --- a/packages/flutter_tools/test/general.shard/windows/plugins_test.dart +++ b/packages/flutter_tools/test/general.shard/windows/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 'package:file/file.dart'; import 'package:file/memory.dart'; import 'package:file_testing/file_testing.dart'; diff --git a/packages/flutter_tools/test/general.shard/windows/project_test.dart b/packages/flutter_tools/test/general.shard/windows/project_test.dart index 9b907c4754..5a77c287c3 100644 --- a/packages/flutter_tools/test/general.shard/windows/project_test.dart +++ b/packages/flutter_tools/test/general.shard/windows/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/file.dart'; import 'package:file/memory.dart'; import 'package:flutter_tools/src/project.dart'; diff --git a/packages/flutter_tools/test/src/custom_devices_common.dart b/packages/flutter_tools/test/src/custom_devices_common.dart index e6f0069493..4e62ee3405 100644 --- a/packages/flutter_tools/test/src/custom_devices_common.dart +++ b/packages/flutter_tools/test/src/custom_devices_common.dart @@ -2,15 +2,13 @@ // 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/convert.dart'; import 'package:flutter_tools/src/custom_devices/custom_device_config.dart'; void writeCustomDevicesConfigFile( Directory dir, { - List configs, + List? configs, dynamic json }) { dir.createSync(recursive: true);