diff --git a/dev/conductor/core/test/next_test.dart b/dev/conductor/core/test/next_test.dart index 192853459f..803b3ec427 100644 --- a/dev/conductor/core/test/next_test.dart +++ b/dev/conductor/core/test/next_test.dart @@ -151,7 +151,7 @@ void main() { ), FakeCommand( command: const ['git', 'checkout', workingBranch], - onRun: () { + onRun: (_) { final File file = fileSystem.file('$checkoutsParentDirectory/engine/.ci.yaml') ..createSync(recursive: true); _initializeCiYamlFile(file); @@ -402,7 +402,7 @@ void main() { const FakeCommand(command: ['git', 'fetch', 'upstream']), FakeCommand( command: const ['git', 'checkout', workingBranch], - onRun: () { + onRun: (_) { final File file = fileSystem.file('$checkoutsParentDirectory/framework/.ci.yaml') ..createSync(); _initializeCiYamlFile(file); @@ -504,7 +504,7 @@ void main() { const FakeCommand(command: ['git', 'fetch', 'upstream']), FakeCommand( command: const ['git', 'checkout', workingBranch], - onRun: () { + onRun: (_) { final File file = fileSystem.file('$checkoutsParentDirectory/framework/.ci.yaml') ..createSync(); _initializeCiYamlFile(file); @@ -600,7 +600,7 @@ void main() { // we want merged upstream commit, not local working commit FakeCommand( command: const ['git', 'checkout', 'upstream/$candidateBranch'], - onRun: () { + onRun: (_) { final File file = fileSystem.file('$checkoutsParentDirectory/framework/.ci.yaml') ..createSync(); _initializeCiYamlFile(file); @@ -686,7 +686,7 @@ void main() { const FakeCommand(command: ['git', 'fetch', 'upstream']), FakeCommand( command: const ['git', 'checkout', workingBranch], - onRun: () { + onRun: (_) { final File file = fileSystem.file('$checkoutsParentDirectory/framework/.ci.yaml') ..createSync(); _initializeCiYamlFile(file); diff --git a/dev/conductor/core/test/repository_test.dart b/dev/conductor/core/test/repository_test.dart index bcddb514ba..a24553cc75 100644 --- a/dev/conductor/core/test/repository_test.dart +++ b/dev/conductor/core/test/repository_test.dart @@ -254,7 +254,7 @@ vars = { ]), FakeCommand( command: const ['git', 'checkout', candidateBranch, '--'], - onRun: () => createdCandidateBranch = true, + onRun: (_) => createdCandidateBranch = true, ), const FakeCommand( command: ['git', 'checkout', 'stable', '--'], @@ -309,7 +309,7 @@ vars = { ]), FakeCommand( command: const ['git', 'checkout', candidateBranch, '--'], - onRun: () => createdCandidateBranch = true, + onRun: (_) => createdCandidateBranch = true, ), const FakeCommand( command: ['git', 'checkout', EngineRepository.defaultBranch], diff --git a/dev/conductor/core/test/start_test.dart b/dev/conductor/core/test/start_test.dart index 5c482aece3..0a23e772f0 100644 --- a/dev/conductor/core/test/start_test.dart +++ b/dev/conductor/core/test/start_test.dart @@ -159,7 +159,7 @@ void main() { EngineRepository.defaultUpstream, engine.path, ], - onRun: () { + onRun: (_) { // Create the DEPS file which the tool will update engine.createSync(recursive: true); depsFile @@ -368,7 +368,7 @@ void main() { EngineRepository.defaultUpstream, engine.path, ], - onRun: () { + onRun: (_) { // Create the DEPS file which the tool will update engine.createSync(recursive: true); depsFile @@ -554,7 +554,7 @@ void main() { EngineRepository.defaultUpstream, engine.path, ], - onRun: () { + onRun: (_) { // Create the DEPS file which the tool will update engine.createSync(recursive: true); depsFile @@ -763,7 +763,7 @@ void main() { EngineRepository.defaultUpstream, engine.path, ], - onRun: () { + onRun: (_) { // Create the DEPS file which the tool will update engine.createSync(recursive: true); depsFile @@ -972,7 +972,7 @@ void main() { EngineRepository.defaultUpstream, engine.path, ], - onRun: () { + onRun: (_) { // Create the DEPS file which the tool will update engine.createSync(recursive: true); depsFile diff --git a/dev/tools/test/create_api_docs_test.dart b/dev/tools/test/create_api_docs_test.dart index 811885e13e..8e6d8e6f73 100644 --- a/dev/tools/test/create_api_docs_test.dart +++ b/dev/tools/test/create_api_docs_test.dart @@ -403,7 +403,7 @@ void main() { 'flutter,Dart,${apidocs.kPlatformIntegrationPackageName},flutter_test,flutter_driver', '--auto-include-dependencies', ], - onRun: () { + onRun: (_) { for (final File canary in generator.canaries) { canary.createSync(recursive: true); } diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_aar_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_aar_test.dart index d57f5b3092..0e74544ae6 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_aar_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_aar_test.dart @@ -111,7 +111,7 @@ flutter: ...List.filled(5, RegExp(r'-P[a-zA-Z-]+=.*')), 'assembleAar$buildMode', ], - onRun: () => fs.directory('/build/host/outputs/repo').createSync(recursive: true), + onRun: (_) => fs.directory('/build/host/outputs/repo').createSync(recursive: true), )), ]); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart index 9e88a5e6f1..9adee59ee0 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart @@ -117,7 +117,7 @@ void main() { 'xattr', '-r', '-d', 'com.apple.FinderInfo', '/', ]); - FakeCommand setUpRsyncCommand({void Function()? onRun}) { + FakeCommand setUpRsyncCommand({void Function(List command)? onRun}) { return FakeCommand( command: const [ 'rsync', @@ -131,7 +131,7 @@ void main() { ); } - FakeCommand setUpXCResultCommand({String stdout = '', void Function()? onRun}) { + FakeCommand setUpXCResultCommand({String stdout = '', void Function(List command)? onRun}) { return FakeCommand( command: const [ 'xcrun', @@ -157,7 +157,7 @@ void main() { String? deviceId, int exitCode = 0, String? stdout, - void Function()? onRun, + void Function(List command)? onRun, }) { return FakeCommand( command: [ @@ -296,7 +296,7 @@ void main() { processManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.directory('build/ios/Release-iphoneos/Runner.app').createSync(recursive: true); }), setUpRsyncCommand(), @@ -335,7 +335,7 @@ void main() { xattrCommand, setUpFakeXcodeBuildHandler( disablePortPublication: true, - onRun: () { + onRun: (_) { fileSystem.directory('build/ios/Release-iphoneos/Runner.app').createSync(recursive: true); }, ), @@ -366,7 +366,7 @@ void main() { ProcessManager: () => FakeProcessManager.list([ xattrCommand, setUpFakeXcodeBuildHandler( - onRun: () { + onRun: (_) { fileSystem.directory('build/ios/Release-iphoneos/Runner.app').createSync(recursive: true); }, ), @@ -389,7 +389,7 @@ void main() { processManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(customNaming: true, onRun: () { + setUpFakeXcodeBuildHandler(customNaming: true, onRun: (_) { fileSystem.directory('build/ios/Release-iphoneos/Runner.app').createSync(recursive: true); }), setUpRsyncCommand(), @@ -423,7 +423,7 @@ void main() { ); processManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(deviceId: '1234', onRun: () { + setUpFakeXcodeBuildHandler(deviceId: '1234', onRun: (_) { fileSystem.directory('build/ios/Release-iphoneos/Runner.app').createSync(recursive: true); }), setUpRsyncCommand(), @@ -453,7 +453,7 @@ void main() { ); processManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(simulator: true, onRun: () { + setUpFakeXcodeBuildHandler(simulator: true, onRun: (_) { fileSystem.directory('build/ios/Debug-iphonesimulator/Runner.app').createSync(recursive: true); }), setUpRsyncCommand(), @@ -483,7 +483,7 @@ void main() { createMinimalMockProjectFiles(); processManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(verbose: true, onRun: () { + setUpFakeXcodeBuildHandler(verbose: true, onRun: (_) { fileSystem.directory('build/ios/Release-iphoneos/Runner.app').createSync(recursive: true); }), setUpRsyncCommand(), @@ -511,7 +511,7 @@ void main() { ); processManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.directory('build/ios/Release-iphoneos/Runner.app').createSync(recursive: true); fileSystem.file('build/flutter_size_01/snapshot.arm64.json') ..createSync(recursive: true) @@ -528,7 +528,7 @@ void main() { ..createSync(recursive: true) ..writeAsStringSync('{}'); }), - setUpRsyncCommand(onRun: () => fileSystem.file('build/ios/iphoneos/Runner.app/Frameworks/App.framework/App') + setUpRsyncCommand(onRun: (_) => fileSystem.file('build/ios/iphoneos/Runner.app/Frameworks/App.framework/App') ..createSync(recursive: true) ..writeAsBytesSync(List.generate(10000, (int index) => 0))), ]); @@ -609,11 +609,11 @@ void main() { FileSystem: () => fileSystem, ProcessManager: () => FakeProcessManager.list([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.directory('build/ios/Release-iphoneos/Runner.app') .createSync(recursive: true); }), - setUpRsyncCommand(onRun: () => + setUpRsyncCommand(onRun: (_) => fileSystem.file('build/ios/iphoneos/Runner.app/Frameworks/App.framework/App') ..createSync(recursive: true) ..writeAsBytesSync(List.generate(10000, (int index) => 0))), @@ -672,11 +672,11 @@ void main() { FileSystem: () => fileSystem, ProcessManager: () => FakeProcessManager.list([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.directory('build/ios/Release-iphoneos/Runner.app') .createSync(recursive: true); }), - setUpRsyncCommand(onRun: () => + setUpRsyncCommand(onRun: (_) => fileSystem.file('build/ios/iphoneos/Runner.app/Frameworks/App.framework/App') ..createSync(recursive: true) ..writeAsBytesSync(List.generate(10000, (int index) => 0))), @@ -716,7 +716,7 @@ void main() { ); processManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () { + setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync(); }), setUpXCResultCommand(), @@ -751,7 +751,7 @@ void main() { ); processManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () { + setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync(); }, stdout: 'Lots of spew from Xcode', ), @@ -790,7 +790,7 @@ void main() { ); processManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () { + setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync(); }), setUpXCResultCommand(stdout: kSampleResultJsonWithIssuesToBeDiscarded), @@ -860,7 +860,7 @@ void main() { ); processManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () { + setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync(); }), setUpXCResultCommand(stdout: kSampleResultJsonWithProvisionIssue), @@ -901,7 +901,7 @@ void main() { xattrCommand, setUpFakeXcodeBuildHandler( exitCode: 1, - onRun: () { + onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync(); } ), @@ -938,7 +938,7 @@ void main() { ); processManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () { + setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync(); }), setUpXCResultCommand(stdout: kSampleResultJsonWithActionIssues), @@ -977,13 +977,13 @@ void main() { setUpFakeXcodeBuildHandler( exitCode: 1, stdout: '$kConcurrentRunFailureMessage1 $kConcurrentRunFailureMessage2', - onRun: () { + onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).childFile('result.xcresult').createSync(recursive: true); } ), // The second xcodebuild is triggered due to above concurrent run failure message. setUpFakeXcodeBuildHandler( - onRun: () { + onRun: (_) { // If the file is not cleaned, throw an error, test failure. if (fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).existsSync()) { throwToolExit('xcresult bundle file existed.', exitCode: 2); @@ -1025,7 +1025,7 @@ void main() { stdout: ''' Runner requires a provisioning profile. Select a provisioning profile in the Signing & Capabilities editor ''', - onRun: () { + onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync(); } ), @@ -1063,7 +1063,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig xattrCommand, setUpFakeXcodeBuildHandler( exitCode: 1, - onRun: () { + onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync(); } ), @@ -1115,7 +1115,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig stdout: ''' Runner requires a provisioning profile. Select a provisioning profile in the Signing & Capabilities editor ''', - onRun: () { + onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync(); } ), @@ -1141,7 +1141,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig xattrCommand, setUpFakeXcodeBuildHandler( exitCode: 1, - onRun: () { + onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync(); } ), @@ -1178,7 +1178,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig xattrCommand, setUpFakeXcodeBuildHandler( exitCode: 1, - onRun: () { + onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync(); } ), @@ -1217,7 +1217,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig xattrCommand, setUpFakeXcodeBuildHandler( exitCode: 1, - onRun: () { + onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync(); } ), @@ -1259,7 +1259,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig setUpFakeXcodeBuildHandler( simulator: true, exitCode: 1, - onRun: () { + onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync(); }, ), @@ -1298,7 +1298,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig setUpFakeXcodeBuildHandler( simulator: true, exitCode: 1, - onRun: () { + onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync(); }, ), @@ -1339,7 +1339,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig setUpFakeXcodeBuildHandler( simulator: true, exitCode: 1, - onRun: () { + onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync(); }, ), diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart index 96dba9db9e..a90f414d01 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart @@ -137,7 +137,7 @@ void main() { 'xattr', '-r', '-d', 'com.apple.FinderInfo', '/', ]); - FakeCommand setUpXCResultCommand({String stdout = '', void Function()? onRun}) { + FakeCommand setUpXCResultCommand({String stdout = '', void Function(List command)? onRun}) { return FakeCommand( command: const [ 'xcrun', @@ -155,7 +155,11 @@ void main() { // Creates a FakeCommand for the xcodebuild call to build the app // in the given configuration. - FakeCommand setUpFakeXcodeBuildHandler({ bool verbose = false, int exitCode = 0, void Function()? onRun }) { + FakeCommand setUpFakeXcodeBuildHandler({ + bool verbose = false, + int exitCode = 0, + void Function(List args)? onRun, + }) { return FakeCommand( command: [ 'xcrun', @@ -202,7 +206,7 @@ void main() { '-exportOptionsPlist', exportOptionsPlist, ], - onRun: () { + onRun: (_) { // exportOptionsPlist will be cleaned up within the command. // Save it somewhere else so test expectations can be run on it. if (cachePlist != null) { @@ -840,7 +844,7 @@ void main() { ..writeAsBytesSync(List.generate(10000, (int index) => 0)); fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.file('build/flutter_size_01/snapshot.arm64.json') ..createSync(recursive: true) ..writeAsStringSync(''' @@ -936,7 +940,7 @@ void main() { ); fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () { + setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync(); }), setUpXCResultCommand(), @@ -970,7 +974,7 @@ void main() { ); fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () { + setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync(); }), setUpXCResultCommand(stdout: kSampleResultJsonWithIssues), @@ -1005,7 +1009,7 @@ void main() { ); fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () { + setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync(); }), setUpXCResultCommand(stdout: kSampleResultJsonWithIssuesToBeDiscarded), @@ -1074,7 +1078,7 @@ void main() { ); fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () { + setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) { fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync(); }), setUpXCResultCommand(stdout: kSampleResultJsonWithProvisionIssue), @@ -1106,7 +1110,7 @@ void main() { const String plistPath = 'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist'; fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.file(plistPath).createSync(recursive: true); }), exportArchiveCommand(exportOptionsPlist: _exportOptionsPlist), @@ -1159,7 +1163,7 @@ void main() { const String plistPath = 'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist'; fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.file(plistPath).createSync(recursive: true); }), exportArchiveCommand(exportOptionsPlist: _exportOptionsPlist), @@ -1218,7 +1222,7 @@ void main() { const String plistPath = 'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist'; fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.file(plistPath).createSync(recursive: true); }), exportArchiveCommand(exportOptionsPlist: _exportOptionsPlist), @@ -1277,7 +1281,7 @@ void main() { const String plistPath = 'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist'; fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.file(plistPath).createSync(recursive: true); }), exportArchiveCommand(exportOptionsPlist: _exportOptionsPlist), @@ -1320,7 +1324,7 @@ void main() { const String plistPath = 'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist'; fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.file(plistPath).createSync(recursive: true); }), exportArchiveCommand(exportOptionsPlist: _exportOptionsPlist), @@ -1366,7 +1370,7 @@ void main() { fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.file(templateIconContentsJsonPath) ..createSync(recursive: true) ..writeAsStringSync(''' @@ -1448,7 +1452,7 @@ void main() { fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.file(templateIconContentsJsonPath) ..createSync(recursive: true) ..writeAsStringSync(''' @@ -1528,7 +1532,7 @@ void main() { fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.file(projectIconContentsJsonPath) ..createSync(recursive: true) ..writeAsStringSync(''' @@ -1590,7 +1594,7 @@ void main() { fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.file(projectIconContentsJsonPath) ..createSync(recursive: true) ..writeAsStringSync(''' @@ -1653,7 +1657,7 @@ void main() { fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.file(projectIconContentsJsonPath) ..createSync(recursive: true) ..writeAsStringSync(''' @@ -1715,7 +1719,7 @@ void main() { fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { // Uses unknown format version 123. fileSystem.file(projectIconContentsJsonPath) ..createSync(recursive: true) @@ -1787,7 +1791,7 @@ void main() { fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { // The following json contains examples of: // - invalid size // - invalid scale @@ -1892,7 +1896,7 @@ void main() { fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.file(templateLaunchImageContentsJsonPath) ..createSync(recursive: true) ..writeAsStringSync(''' @@ -1973,7 +1977,7 @@ void main() { fakeProcessManager.addCommands([ xattrCommand, - setUpFakeXcodeBuildHandler(onRun: () { + setUpFakeXcodeBuildHandler(onRun: (_) { fileSystem.file(templateLaunchImageContentsJsonPath) ..createSync(recursive: true) ..writeAsStringSync(''' diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart index 8cae50d8ab..5232513cdb 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart @@ -90,7 +90,7 @@ void main() { // Returns the command matching the build_linux call to cmake. FakeCommand cmakeCommand(String buildMode, { String target = 'x64', - void Function()? onRun, + void Function(List command)? onRun, }) { return FakeCommand( command: [ @@ -110,7 +110,7 @@ void main() { FakeCommand ninjaCommand(String buildMode, { Map? environment, String target = 'x64', - void Function()? onRun, + void Function(List command)? onRun, String stdout = '', }) { return FakeCommand( @@ -279,7 +279,7 @@ void main() { setUpMockProjectFilesForBuild(); processManager.addCommands([ cmakeCommand('release'), - ninjaCommand('release', onRun: () { + ninjaCommand('release', onRun: (_) { throw ArgumentError(); }), ]); @@ -694,7 +694,7 @@ set(BINARY_NAME "fizz_bar") setUpMockProjectFilesForBuild(); processManager.addCommands([ cmakeCommand('release'), - ninjaCommand('release', onRun: () { + ninjaCommand('release', onRun: (_) { fileSystem.file('build/flutter_size_01/snapshot.linux-x64.json') ..createSync(recursive: true) ..writeAsStringSync(''' @@ -751,7 +751,7 @@ set(BINARY_NAME "fizz_bar") setUpMockProjectFilesForBuild(); processManager.addCommands([ cmakeCommand('release', target: 'arm64'), - ninjaCommand('release', target: 'arm64', onRun: () { + ninjaCommand('release', target: 'arm64', onRun: (_) { fileSystem.file('build/flutter_size_01/snapshot.linux-arm64.json') ..createSync(recursive: true) ..writeAsStringSync(''' diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart index f12b919336..d486e6efa8 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart @@ -109,7 +109,7 @@ void main() { // Creates a FakeCommand for the xcodebuild call to build the app // in the given configuration. - FakeCommand setUpFakeXcodeBuildHandler(String configuration, { bool verbose = false, void Function()? onRun }) { + FakeCommand setUpFakeXcodeBuildHandler(String configuration, { bool verbose = false, void Function(List command)? onRun }) { final FlutterProject flutterProject = FlutterProject.fromDirectory(fileSystem.currentDirectory); final Directory flutterBuildDir = fileSystem.directory(getMacOSBuildDirectory()); return FakeCommand( @@ -147,12 +147,12 @@ Thread: <_NSMainThread: 0x6000027c0280>{number = 1, name = main} Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide. STDERR STUFF ''', - onRun: () { + onRun: (List command) { fileSystem.file(fileSystem.path.join('macos', 'Flutter', 'ephemeral', '.app_filename')) ..createSync(recursive: true) ..writeAsStringSync('example.app'); if (onRun != null) { - onRun(); + onRun(command); } } ); @@ -658,7 +658,7 @@ STDERR STUFF ProcessManager: () => FakeProcessManager.list([ // These are generated by gen_snapshot because flutter assemble passes // extra flags specifying this output path - setUpFakeXcodeBuildHandler('Release', onRun: () { + setUpFakeXcodeBuildHandler('Release', onRun: (_) { fileSystem.file('build/flutter_size_01/snapshot.arm64.json') ..createSync(recursive: true) ..writeAsStringSync(''' diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart index 79fb6dee1f..930f3e9846 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart @@ -79,7 +79,7 @@ void main() { // Returns the command matching the build_windows call to generate CMake // files. FakeCommand cmakeGenerationCommand({ - void Function()? onRun, + void Function(List command)? onRun, String generator = _defaultGenerator, }) { return FakeCommand( @@ -102,7 +102,7 @@ void main() { // Returns the command matching the build_windows call to build. FakeCommand buildCommand(String buildMode, { bool verbose = false, - void Function()? onRun, + void Function(List command)? onRun, String stdout = '', }) { return FakeCommand( @@ -948,7 +948,7 @@ if %errorlevel% neq 0 goto :VCEnd processManager = FakeProcessManager.list([ cmakeGenerationCommand(), - buildCommand('Release', onRun: () { + buildCommand('Release', onRun: (_) { fileSystem.file(r'build\flutter_size_01\snapshot.windows-x64.json') ..createSync(recursive: true) ..writeAsStringSync(''' diff --git a/packages/flutter_tools/test/commands.shard/hermetic/upgrade_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/upgrade_test.dart index 3b7c116fc6..d869309ece 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/upgrade_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/upgrade_test.dart @@ -46,7 +46,7 @@ void main() { const String upstreamHeadRevision = 'deadbeef'; final Completer reEntryCompleter = Completer(); - Future reEnterTool() async { + Future reEnterTool(List command) async { await runner.run(['upgrade', '--continue', '--no-version-check']); reEntryCompleter.complete(); } @@ -128,7 +128,7 @@ void main() { testUsingContext('can push people from master to beta', () async { final Completer reEntryCompleter = Completer(); - Future reEnterTool() async { + Future reEnterTool(List args) async { await runner.run(['upgrade', '--continue', '--no-version-check']); reEntryCompleter.complete(); } @@ -207,7 +207,7 @@ void main() { testUsingContext('do not push people from beta to anything else', () async { final Completer reEntryCompleter = Completer(); - Future reEnterTool() async { + Future reEnterTool(List command) async { await runner.run(['upgrade', '--continue', '--no-version-check']); reEntryCompleter.complete(); } diff --git a/packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart b/packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart index dee0bd4094..940637ce79 100644 --- a/packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart @@ -479,7 +479,7 @@ void main() { 'assembleRelease', ], exitCode: 1, - onRun: () { + onRun: (_) { throw const ProcessException('', [], 'Unrecognized'); } )); diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_test.dart index 77a4e68262..ec86b3b5b6 100644 --- a/packages/flutter_tools/test/general.shard/asset_bundle_test.dart +++ b/packages/flutter_tools/test/general.shard/asset_bundle_test.dart @@ -792,7 +792,7 @@ flutter: '--include=/$assetsPath', '--include=$shaderLibDir', ], - onRun: () { + onRun: (_) { fileSystem.file(outputPath).createSync(recursive: true); fileSystem.file('$outputPath.spirv').createSync(recursive: true); }, @@ -839,7 +839,7 @@ flutter: '--include=/$assetsPath', '--include=$shaderLibDir', ], - onRun: () { + onRun: (_) { fileSystem.file(outputPath).createSync(recursive: true); fileSystem.file('$outputPath.spirv').createSync(recursive: true); }, @@ -880,7 +880,7 @@ flutter: '--include=${fileSystem.path.join(materialDir.path, 'shaders')}', '--include=$shaderLibDir', ], - onRun: () { + onRun: (_) { fileSystem.file(outputPath).createSync(recursive: true); fileSystem.file('$outputPath.spirv').createSync(recursive: true); }, diff --git a/packages/flutter_tools/test/general.shard/base/os_test.dart b/packages/flutter_tools/test/general.shard/base/os_test.dart index 5d6765cc8c..c121904705 100644 --- a/packages/flutter_tools/test/general.shard/base/os_test.dart +++ b/packages/flutter_tools/test/general.shard/base/os_test.dart @@ -670,7 +670,7 @@ void main() { '-d', tempDirectory.path, ], - onRun: () { + onRun: (_) { expect(tempDirectory, exists); tempDirectory.childDirectory('dirA').childFile('fileA').createSync(recursive: true); tempDirectory.childDirectory('dirB').childFile('fileB').createSync(recursive: true); diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart index fd60327c33..ccffea131a 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart @@ -599,7 +599,7 @@ void main() { 'Artifact.flutterFramework.TargetPlatform.ios.debug.EnvironmentType.simulator', outputDir.path, ], - onRun: () => binary.createSync(recursive: true), + onRun: (_) => binary.createSync(recursive: true), ), lipoCommandNonFatResult, FakeCommand(command: [ diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart index a69c72c792..680d826b49 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart @@ -138,7 +138,7 @@ void main() { // destination environment.outputDir.path, ], - onRun: () { + onRun: (_) { entitlements.writeAsStringSync('foo'); withoutEntitlements.writeAsStringSync('bar'); nestedEntitlements.writeAsStringSync('somefile.bin'); diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart index e9e9437d62..bf238eb446 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart @@ -54,7 +54,7 @@ void main() { '--include=$fragDir', '--include=$shaderLibDir', ], - onRun: () { + onRun: (_) { fileSystem.file(outputPath).createSync(recursive: true); fileSystem.file(outputSpirvPath).createSync(recursive: true); }, @@ -94,7 +94,7 @@ void main() { '--include=$fragDir', '--include=$shaderLibDir', ], - onRun: () { + onRun: (_) { fileSystem.file(outputPath).createSync(recursive: true); }, ), @@ -133,7 +133,7 @@ void main() { '--include=$fragDir', '--include=$shaderLibDir', ], - onRun: () { + onRun: (_) { fileSystem.file(outputPath).createSync(recursive: true); }, ), @@ -171,7 +171,7 @@ void main() { '--include=$fragDir', '--include=$shaderLibDir', ], - onRun: () { + onRun: (_) { fileSystem.file(outputPath).createSync(recursive: true); fileSystem.file(outputSpirvPath).createSync(recursive: true); }, @@ -253,7 +253,7 @@ void main() { '--include=$fragDir', '--include=$shaderLibDir', ], - onRun: () { + onRun: (_) { fileSystem.file('/.tmp_rand0/0.8255140718871702.temp.spirv').createSync(); fileSystem.file('/.tmp_rand0/0.8255140718871702.temp') ..createSync() @@ -301,7 +301,7 @@ void main() { '--include=$fragDir', '--include=$shaderLibDir', ], - onRun: () { + onRun: (_) { fileSystem.file('/.tmp_rand0/0.8255140718871702.temp.spirv').createSync(); fileSystem.file('/.tmp_rand0/0.8255140718871702.temp') ..createSync() @@ -349,7 +349,7 @@ void main() { '--include=$fragDir', '--include=$shaderLibDir', ], - onRun: () { + onRun: (_) { fileSystem.file('/.tmp_rand0/0.8255140718871702.temp.spirv').createSync(); fileSystem.file('/.tmp_rand0/0.8255140718871702.temp') ..createSync() @@ -398,7 +398,7 @@ void main() { '--include=$fragDir', '--include=$shaderLibDir', ], - onRun: () { + onRun: (_) { fileSystem.file('/.tmp_rand0/0.8255140718871702.temp.spirv').createSync(); fileSystem.file('/.tmp_rand0/0.8255140718871702.temp') ..createSync() diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart index 73421c01cb..b4c0cbd7e4 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart @@ -590,7 +590,7 @@ void main() { '--packages=.dart_tool/package_config.json', '--cfe-only', environment.buildDir.childFile('main.dart').absolute.path, - ], onRun: () { + ], onRun: (_) { environment.buildDir.childFile('app.dill.deps') .writeAsStringSync('file:///a.dart'); }, @@ -809,7 +809,7 @@ void main() { environment.buildDir.childFile('main.dart').absolute.path, environment.buildDir.childFile('main.dart.unopt.wasm').absolute.path, ], - onRun: () => outputJsFile..createSync()..writeAsStringSync('foo')) + onRun: (_) => outputJsFile..createSync()..writeAsStringSync('foo')) ); processManager.addCommand(FakeCommand( @@ -848,7 +848,7 @@ void main() { environment.buildDir.childFile('main.dart').absolute.path, environment.buildDir.childFile('main.dart.unopt.wasm').absolute.path, ], - onRun: () => outputJsFile..createSync()..writeAsStringSync('foo')) + onRun: (_) => outputJsFile..createSync()..writeAsStringSync('foo')) ); processManager.addCommand(FakeCommand( @@ -884,7 +884,7 @@ void main() { '--depfile=${depFile.absolute.path}', environment.buildDir.childFile('main.dart').absolute.path, environment.buildDir.childFile('main.dart.unopt.wasm').absolute.path, - ], onRun: () => outputJsFile..createSync()..writeAsStringSync('foo'))); + ], onRun: (_) => outputJsFile..createSync()..writeAsStringSync('foo'))); processManager.addCommand(FakeCommand( command: [ @@ -919,7 +919,7 @@ void main() { '--depfile=${depFile.absolute.path}', environment.buildDir.childFile('main.dart').absolute.path, environment.buildDir.childFile('main.dart.wasm').absolute.path, - ], onRun: () => outputJsFile..createSync()..writeAsStringSync('foo'))); + ], onRun: (_) => outputJsFile..createSync()..writeAsStringSync('foo'))); await Dart2WasmTarget(WebRendererMode.canvaskit).build(environment); }, overrides: { @@ -942,7 +942,7 @@ void main() { environment.buildDir.childFile('main.dart').absolute.path, environment.buildDir.childFile('main.dart.unopt.wasm').absolute.path, ], - onRun: () => outputJsFile..createSync()..writeAsStringSync('foo')) + onRun: (_) => outputJsFile..createSync()..writeAsStringSync('foo')) ); processManager.addCommand(FakeCommand( diff --git a/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart b/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart index 3f4cdbf88a..c0be312257 100644 --- a/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart +++ b/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart @@ -227,7 +227,7 @@ void main() { processManager: FakeProcessManager.list([ FakeCommand( command: testConfig.pingCommand, - onRun: () => pingCommandWasExecuted = true, + onRun: (_) => pingCommandWasExecuted = true, stdout: testConfigPingSuccessOutput ), ]), @@ -318,7 +318,7 @@ void main() { logger: BufferLogger.test(), processManager: FakeProcessManager.list([ FakeCommand(command: testConfig.uninstallCommand), - FakeCommand(command: testConfig.installCommand, onRun: () => bothCommandsWereExecuted = true), + FakeCommand(command: testConfig.installCommand, onRun: (_) => bothCommandsWereExecuted = true), ]) ); @@ -522,7 +522,7 @@ void main() { final FakeProcessManager processManager = FakeProcessManager.list([ FakeCommand( command: testConfig.screenshotCommand!, - onRun: () => screenshotCommandWasExecuted = true, + onRun: (_) => screenshotCommandWasExecuted = true, ), ]); @@ -548,7 +548,7 @@ void main() { final FakeProcessManager processManager = FakeProcessManager.list([ FakeCommand( command: testConfig.screenshotCommand!, - onRun: () => screenshotCommandWasExecuted = true, + onRun: (_) => screenshotCommandWasExecuted = true, ), ]); diff --git a/packages/flutter_tools/test/general.shard/dart/pub_get_test.dart b/packages/flutter_tools/test/general.shard/dart/pub_get_test.dart index 53091963bb..515cf6321f 100644 --- a/packages/flutter_tools/test/general.shard/dart/pub_get_test.dart +++ b/packages/flutter_tools/test/general.shard/dart/pub_get_test.dart @@ -396,7 +396,7 @@ void main() { 'get', '--example', ], - onRun: () { + onRun: (_) { fileSystem .file('.dart_tool/package_config.json') .createSync(recursive: true); @@ -646,7 +646,7 @@ exit code: 66 'get', '--example', ], - onRun: () { + onRun: (_) { throw const ProcessException( 'bin/cache/dart-sdk/bin/dart', [ @@ -842,7 +842,7 @@ exit code: 66 'FLUTTER_ROOT': '', 'PUB_ENVIRONMENT': 'flutter_cli:flutter_tests', }, - onRun: () { + onRun: (_) { fileSystem.currentDirectory .childDirectory('.dart_tool') .childFile('package_config.json') @@ -908,7 +908,7 @@ exit code: 66 'FLUTTER_ROOT': '', 'PUB_ENVIRONMENT': 'flutter_cli:flutter_tests', }, - onRun: () { + onRun: (_) { fileSystem.currentDirectory .childDirectory('.dart_tool') .childFile('package_config.json') @@ -1155,7 +1155,7 @@ exit code: 66 'get', '--example', ], - onRun: () { + onRun: (_) { fileSystem .file('.dart_tool/package_config.json') .setLastModifiedSync(DateTime(2002)); @@ -1181,7 +1181,7 @@ exit code: 66 'get', '--example', ], - onRun: () { + onRun: (_) { fileSystem.file('pubspec.yaml').setLastModifiedSync(DateTime(2002)); }), const FakeCommand( diff --git a/packages/flutter_tools/test/general.shard/ios/core_devices_test.dart b/packages/flutter_tools/test/general.shard/ios/core_devices_test.dart index 3a9f59721a..1313b42134 100644 --- a/packages/flutter_tools/test/general.shard/ios/core_devices_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/core_devices_test.dart @@ -156,7 +156,7 @@ void main() { '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -231,7 +231,7 @@ void main() { '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -277,7 +277,7 @@ ERROR: The file couldn’t be opened because it doesn’t exist. (NSCocoaErrorDo '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -314,7 +314,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -385,7 +385,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -460,7 +460,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -506,7 +506,7 @@ ERROR: The file couldn’t be opened because it doesn’t exist. (NSCocoaErrorDo '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -543,7 +543,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -633,7 +633,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -722,7 +722,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -792,7 +792,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -837,7 +837,7 @@ ERROR: The operation couldn?t be completed. (OSStatus error -10814.) (NSOSStatus '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -875,7 +875,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -976,7 +976,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -1084,7 +1084,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -1154,7 +1154,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -1222,7 +1222,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -1266,7 +1266,7 @@ ERROR: The specified device was not found. (com.apple.dt.CoreDeviceError error 1 '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -1305,7 +1305,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -1340,7 +1340,7 @@ invalid JSON ]; fakeProcessManager.addCommand(FakeCommand( command: args, - onRun: () { + onRun: (_) { // Simulate that this command threw and simultaneously the OS // deleted the temp directory expect(tempFile, exists); @@ -1395,7 +1395,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -1457,7 +1457,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -1520,7 +1520,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -1576,7 +1576,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -1640,7 +1640,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -1713,7 +1713,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -1797,7 +1797,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -1852,7 +1852,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -1902,7 +1902,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, @@ -1957,7 +1957,7 @@ invalid JSON '--json-output', tempFile.path, ], - onRun: () { + onRun: (_) { expect(tempFile, exists); tempFile.writeAsStringSync(deviceControlOutput); }, diff --git a/packages/flutter_tools/test/general.shard/ios/xcresult_test.dart b/packages/flutter_tools/test/general.shard/ios/xcresult_test.dart index 19f6944b08..23437aa375 100644 --- a/packages/flutter_tools/test/general.shard/ios/xcresult_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/xcresult_test.dart @@ -35,7 +35,7 @@ void main() { stdout: stdout, stderr: stderr, exitCode: exitCode, - onRun: () {}, + onRun: (_) {}, ); } diff --git a/packages/flutter_tools/test/src/fake_process_manager.dart b/packages/flutter_tools/test/src/fake_process_manager.dart index 305a37cbf9..c3869f3b75 100644 --- a/packages/flutter_tools/test/src/fake_process_manager.dart +++ b/packages/flutter_tools/test/src/fake_process_manager.dart @@ -69,7 +69,13 @@ class FakeCommand { /// A callback that is run after [duration] expires but before the [exitCode] /// (and output) are passed back. - final VoidCallback? onRun; + /// + /// The callback will be provided the full command that matched this instance. + /// This can be useful in the rare scenario where the full command cannot be known + /// ahead of time (i.e. when one or more instances of [RegExp] are used to + /// match the command). For example, the command may contain one or more + /// randomly-generated elements, such as a temporary directory path. + final void Function(List command)? onRun; /// The process' exit code. /// @@ -306,7 +312,7 @@ abstract class FakeProcessManager implements ProcessManager { throw fakeCommand.exception!; // ignore: only_throw_errors } if (fakeCommand.onRun != null) { - fakeCommand.onRun!(); + fakeCommand.onRun!(command); } return FakeProcess( duration: fakeCommand.duration,