From 137149158ca9db688320c286ac6160afa19984c1 Mon Sep 17 00:00:00 2001 From: engine-flutter-autoroll Date: Fri, 19 Jan 2024 11:48:59 -0500 Subject: [PATCH 01/11] Manual roll Flutter (stable) from ef1af02aead6 to 67457e669f79 (1 revision) (#5932) Manual roll requested by dit@google.com https://github.com/flutter/flutter/compare/ef1af02aead6...67457e669f79 If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-stable-packages Please CC dit@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter (stable): https://github.com/flutter/flutter/issues/new/choose To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md --- .ci/flutter_stable.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/flutter_stable.version b/.ci/flutter_stable.version index 50880ebc92e..782df31f91d 100644 --- a/.ci/flutter_stable.version +++ b/.ci/flutter_stable.version @@ -1 +1 @@ -ef1af02aead6fe2414f3aafa5a61087b610e1332 +67457e669f79e9f8d13d7a68fe09775fefbb79f4 From da6d872199f4b37717f261740e72f1f170fcd856 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Jan 2024 17:42:57 +0000 Subject: [PATCH 02/11] Bump actions/upload-artifact from 4.1.0 to 4.2.0 (#5937) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.1.0 to 4.2.0.
Release notes

Sourced from actions/upload-artifact's releases.

v4.2.0

What's Changed

Full Changelog: https://github.com/actions/upload-artifact/compare/v4...v4.2.0

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/upload-artifact&package-manager=github_actions&previous-version=4.1.0&new-version=4.2.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- .github/workflows/scorecards-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index e68c8e8b75d..d765bb04c6e 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -41,7 +41,7 @@ jobs: # Upload the results as artifacts (optional). - name: "Upload artifact" - uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595 # v2.3.1 + uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v2.3.1 with: name: SARIF file path: results.sarif From 7901015fa454eae7ec6ee3b4a410cc6dc566eb6e Mon Sep 17 00:00:00 2001 From: John McCutchan Date: Fri, 19 Jan 2024 13:42:06 -0800 Subject: [PATCH 03/11] Expose registered widget libraries and local widget library widgets. (#5936) This exposes the necessary information to allow rfwpg to display registered libraries and widgets in a list or tree. --- packages/rfw/CHANGELOG.md | 5 +++ packages/rfw/lib/src/flutter/runtime.dart | 39 ++++++++++++++++++- packages/rfw/pubspec.yaml | 2 +- packages/rfw/test/runtime_test.dart | 12 ++++++ .../rfw/test_coverage/bin/test_coverage.dart | 2 +- 5 files changed, 57 insertions(+), 3 deletions(-) diff --git a/packages/rfw/CHANGELOG.md b/packages/rfw/CHANGELOG.md index ae217df2218..99ff72ef28d 100644 --- a/packages/rfw/CHANGELOG.md +++ b/packages/rfw/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.0.18 + +* Exposes `WidgetLibrary`s registered in `Runtime`. +* Exposes widgets map in `LocalWidgetLibrary`. + ## 1.0.17 * Adds support for tracking source locations of `BlobNode`s and diff --git a/packages/rfw/lib/src/flutter/runtime.dart b/packages/rfw/lib/src/flutter/runtime.dart index aabbba4fcde..a610a762ce9 100644 --- a/packages/rfw/lib/src/flutter/runtime.dart +++ b/packages/rfw/lib/src/flutter/runtime.dart @@ -4,10 +4,13 @@ // This file is hand-formatted. +import 'dart:collection'; + import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; -import '../dart/model.dart'; +import '../../formats.dart'; + import 'content.dart'; /// Signature of builders for local widgets. @@ -169,6 +172,22 @@ class LocalWidgetLibrary extends WidgetLibrary { LocalWidgetBuilder? findConstructor(String name) { return _widgets[name]; } + + /// The widgets defined by this [LocalWidgetLibrary]. + /// + /// The returned map is an immutable view of the map provided to the constructor. + /// They keys are the unqualified widget names, and the values are the corresponding + /// [LocalWidgetBuilder]s. + /// + /// The map never changes during the lifetime of the [LocalWidgetLibrary], but a new + /// instance of an [UnmodifiableMapView] is returned each time this getter is used. + /// + /// See also: + /// + /// * [createCoreWidgets], a function that creates a [Map] of local widgets. + UnmodifiableMapView get widgets { + return UnmodifiableMapView(_widgets); + } } class _ResolvedConstructor { @@ -226,6 +245,24 @@ class Runtime extends ChangeNotifier { _clearCache(); } + /// The widget libraries imported in this [Runtime]. + /// + /// The returned map is an immutable view of the map updated by calls to + /// [update] and [clearLibraries]. + /// + /// The keys are instances [LibraryName] which encode fully qualified library + /// names, and the values are the corresponding [WidgetLibrary]s. + /// + /// The returned map is an immutable copy of the registered libraries + /// at the time of this call. + /// + /// See also: + /// + /// * [update] and [clearLibraries], functions that populate this map. + UnmodifiableMapView get libraries { + return UnmodifiableMapView(Map.from(_libraries)); + } + final Map _cachedConstructors = {}; final Map _widgets = {}; diff --git a/packages/rfw/pubspec.yaml b/packages/rfw/pubspec.yaml index 21e215372b5..0d22097d9ec 100644 --- a/packages/rfw/pubspec.yaml +++ b/packages/rfw/pubspec.yaml @@ -2,7 +2,7 @@ name: rfw description: "Remote Flutter widgets: a library for rendering declarative widget description files at runtime." repository: https://github.com/flutter/packages/tree/main/packages/rfw issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+rfw%22 -version: 1.0.17 +version: 1.0.18 environment: sdk: ">=3.0.0 <4.0.0" diff --git a/packages/rfw/test/runtime_test.dart b/packages/rfw/test/runtime_test.dart index 15b2d3c55b2..476c472af95 100644 --- a/packages/rfw/test/runtime_test.dart +++ b/packages/rfw/test/runtime_test.dart @@ -347,6 +347,18 @@ void main() { expect(tester.widget(find.byType(ColoredBox)).color, const Color(0x00000002)); }); + testWidgets('Runtime', (WidgetTester tester) async { + final Runtime runtime = Runtime() + ..update(const LibraryName(['core']), createCoreWidgets()); + expect(runtime.libraries.length, 1); + final LibraryName libraryName = runtime.libraries.entries.first.key; + expect('$libraryName', 'core'); + final WidgetLibrary widgetLibrary = runtime.libraries.entries.first.value; + expect(widgetLibrary, isA()); + widgetLibrary as LocalWidgetLibrary; + expect(widgetLibrary.widgets.length, greaterThan(1)); + }); + testWidgets('Runtime', (WidgetTester tester) async { final Runtime runtime = Runtime() ..update(const LibraryName(['core']), createCoreWidgets()); diff --git a/packages/rfw/test_coverage/bin/test_coverage.dart b/packages/rfw/test_coverage/bin/test_coverage.dart index 392ed70519a..e925d98cd0e 100644 --- a/packages/rfw/test_coverage/bin/test_coverage.dart +++ b/packages/rfw/test_coverage/bin/test_coverage.dart @@ -20,7 +20,7 @@ import 'package:meta/meta.dart'; // Please update these targets when you update this package. // Please ensure that test coverage continues to be 100%. -const int targetLines = 3219; +const int targetLines = 3223; const String targetPercent = '100'; const String lastUpdate = '2023-06-29'; From bb9be73e42cf8b5fa0c36a49ecdcf65ca8cc01a1 Mon Sep 17 00:00:00 2001 From: engine-flutter-autoroll Date: Fri, 19 Jan 2024 17:34:20 -0500 Subject: [PATCH 04/11] Manual roll Flutter from f77f82435a97 to 684247a3c78a (39 revisions) (#5948) Manual roll Flutter from f77f82435a97 to 684247a3c78a (39 revisions) Manual roll requested by dit@google.com https://github.com/flutter/flutter/compare/f77f82435a97...684247a3c78a 2024-01-19 reidbaker@google.com Use Integer instead of int in map in flutter.groovy (flutter/flutter#141895) 2024-01-19 engine-flutter-autoroll@skia.org Roll Flutter Engine from c953c83112ba to f2b441a26416 (4 revisions) (flutter/flutter#141894) 2024-01-19 dacoharkes@google.com Native assets: package in framework on iOS and MacOS (flutter/flutter#140907) 2024-01-19 ian@hixie.ch Revert "Make tests more resilient to Skia gold failures and refactor flutter_goldens for extensive technical debt removal (#140101)" (flutter/flutter#141814) 2024-01-19 engine-flutter-autoroll@skia.org Roll Flutter Engine from 538975f2511b to c953c83112ba (3 revisions) (flutter/flutter#141886) 2024-01-19 36861262+QuncCccccc@users.noreply.github.com Add `showDragHandle` to `showBottomSheet` (flutter/flutter#141754) 2024-01-19 engine-flutter-autoroll@skia.org Roll Flutter Engine from 9a6c64de8a46 to 538975f2511b (8 revisions) (flutter/flutter#141881) 2024-01-19 goderbauer@google.com Make pumpWidget's arguments named (flutter/flutter#141728) 2024-01-19 5236035+fzyzcjy@users.noreply.github.com Tiny fix inaccurate documentations about bindings (flutter/flutter#140282) 2024-01-19 zanderso@users.noreply.github.com Roll engine to 9a6c64de8a4694cef59a338cd33ac1a9e7d23d9d (flutter/flutter#141870) 2024-01-19 engine-flutter-autoroll@skia.org Roll Packages from 83c2c4da97c5 to 129e08c1dff1 (13 revisions) (flutter/flutter#141865) 2024-01-19 godofredoc@google.com Add mac_x64_ios configuration. (flutter/flutter#141828) 2024-01-19 engine-flutter-autoroll@skia.org Roll Flutter Engine from 90be25d8aac3 to d1afda52d254 (1 revision) (flutter/flutter#141825) 2024-01-19 ian@hixie.ch Move the requestKeyboard up to the widgets layer (flutter/flutter#141655) 2024-01-19 engine-flutter-autoroll@skia.org Roll Flutter Engine from dde3ebf6551a to 90be25d8aac3 (1 revision) (flutter/flutter#141817) 2024-01-18 yjbanov@google.com enable more tests in web mode (flutter/flutter#141791) 2024-01-18 engine-flutter-autoroll@skia.org Roll Flutter Engine from 9dded186bcff to dde3ebf6551a (2 revisions) (flutter/flutter#141811) 2024-01-18 davidmartos96@gmail.com Update margin between label and icon in Tab to better reflect Material specs (flutter/flutter#140698) 2024-01-18 engine-flutter-autoroll@skia.org Roll Flutter Engine from 3106e08e1219 to 9dded186bcff (2 revisions) (flutter/flutter#141807) 2024-01-18 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Enable native compilation for windows-arm64 " (flutter/flutter#141809) 2024-01-18 godofredoc@google.com Run framework_tests_misc in arm64 and x64. (flutter/flutter#141797) 2024-01-18 engine-flutter-autoroll@skia.org Roll Flutter Engine from f4a4f046b173 to 3106e08e1219 (1 revision) (flutter/flutter#141802) 2024-01-18 49699333+dependabot[bot]@users.noreply.github.com Bump actions/upload-artifact from 4.1.0 to 4.2.0 (flutter/flutter#141803) 2024-01-18 goderbauer@google.com Update labeler.yml (flutter/flutter#141697) 2024-01-18 engine-flutter-autoroll@skia.org Roll Flutter Engine from 75400c49fa0b to f4a4f046b173 (2 revisions) (flutter/flutter#141800) 2024-01-18 polinach@google.com Reland "Remove hack from PageView." (flutter/flutter#141533) 2024-01-18 smartercallum@gmail.com ScaleGestureRecognizer pointerCount=2 for trackpad gestures (flutter/flutter#140745) 2024-01-18 engine-flutter-autoroll@skia.org Roll Flutter Engine from de68e7612948 to 75400c49fa0b (2 revisions) (flutter/flutter#141796) 2024-01-18 15619084+vashworth@users.noreply.github.com Run `flutter_gallery_ios__start_up` test on Mac-14 in staging (flutter/flutter#141795) 2024-01-18 engine-flutter-autoroll@skia.org Roll Flutter Engine from d80fe1cb5854 to de68e7612948 (1 revision) (flutter/flutter#141789) 2024-01-18 101587250+pbo-linaro@users.noreply.github.com Enable native compilation for windows-arm64 (flutter/flutter#137618) 2024-01-18 xilaizhang@google.com [github actions] Fix token issue on actions/checkout package (flutter/flutter#141652) 2024-01-18 engine-flutter-autoroll@skia.org Roll Flutter Engine from b75d6d80d813 to d80fe1cb5854 (2 revisions) (flutter/flutter#141785) 2024-01-18 jesus_sguerrero@hotmail.com Revert "Native assets: roll deps" (flutter/flutter#141748) 2024-01-18 6655696+guidezpl@users.noreply.github.com Deprecate M2 curves (flutter/flutter#134417) 2024-01-18 rmolivares@renzo-olivares.dev Fix: TextField can inherit `errorStyle` from `InputDecorationTheme`. (flutter/flutter#141227) 2024-01-18 109111084+yaakovschectman@users.noreply.github.com Add check for Bank of Brazil security module to Windows Flutter Doctor validators (flutter/flutter#141135) 2024-01-18 reidbaker@google.com Fix gradle lints No semantic change should be present. (flutter/flutter#141692) 2024-01-18 engine-flutter-autoroll@skia.org Roll Packages from 1a2b780c9108 to 83c2c4da97c5 (5 revisions) (flutter/flutter#141778) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC dit@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human ... --- .ci/flutter_master.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/flutter_master.version b/.ci/flutter_master.version index d362631457c..da43da073d7 100644 --- a/.ci/flutter_master.version +++ b/.ci/flutter_master.version @@ -1 +1 @@ -f77f82435a9725933f4b4db9b35ebeaae87d4b48 +684247a3c78a1d3e46a4fa54e2c1111c74170951 From 44ee590f33ecb2e68e41da30d1acb1b59fa890bc Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Fri, 19 Jan 2024 14:38:11 -0800 Subject: [PATCH 05/11] [ci] Run Swift formatter and linter during CI formatting (#5928) Make `swift-format` CIPD package available on the `PATH` https://flutter-review.googlesource.com/c/recipes/+/54020 Run `format --no-clang-format --no-java --no-kotlin --no-dart` on the macOS builder so it doesn't duplicate same `format` call run on Linux. Filter out generated files until https://github.com/flutter/flutter/issues/141799 is done. Also add `swift-format lint` call during `format` command. Fix the one casing issue it found in a test file. Failing run: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8758535881172004177/+/u/Run_package_tests/Swift_format/stdout Successful run: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8758492350529121249/+/u/Run_package_tests/Swift_format/stdout Fixes https://github.com/flutter/flutter/issues/41129 --- .ci.yaml | 14 +++- ...k_podspecs.yaml => macos_repo_checks.yaml} | 7 ++ .ci/targets/repo_checks.yaml | 3 +- .../macos/RunnerTests/RunnerTests.swift | 2 +- packages/pigeon/tool/shared/generation.dart | 1 + script/tool/lib/src/format_command.dart | 42 +++++++--- script/tool/test/format_command_test.dart | 76 +++++++++++++++++-- 7 files changed, 127 insertions(+), 18 deletions(-) rename .ci/targets/{macos_check_podspecs.yaml => macos_repo_checks.yaml} (56%) diff --git a/.ci.yaml b/.ci.yaml index 96868d5a73e..66f95e165ae 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -1071,7 +1071,11 @@ targets: properties: add_recipes_cq: "true" version_file: flutter_master.version - target_file: macos_check_podspecs.yaml + target_file: macos_repo_checks.yaml + dependencies: > + [ + {"dependency": "swift_format", "version": "build_id:8797338980206841409"} + ] ### macOS desktop tasks ### # macos-platform_tests builds all the packages on ARM, so this build is run @@ -1143,6 +1147,10 @@ targets: { "CHANNEL": "master" } + dependencies: > + [ + {"dependency": "swift_format", "version": "build_id:8797338979890974865"} + ] - name: Mac_arm64 custom_package_tests stable recipe: packages/packages @@ -1156,6 +1164,10 @@ targets: { "CHANNEL": "stable" } + dependencies: > + [ + {"dependency": "swift_format", "version": "build_id:8797338979890974865"} + ] ### iOS tasks ### # ios_platform_tests builds all the packages on ARM, so this build is run diff --git a/.ci/targets/macos_check_podspecs.yaml b/.ci/targets/macos_repo_checks.yaml similarity index 56% rename from .ci/targets/macos_check_podspecs.yaml rename to .ci/targets/macos_repo_checks.yaml index 946ac66f748..7fd858bfe83 100644 --- a/.ci/targets/macos_check_podspecs.yaml +++ b/.ci/targets/macos_repo_checks.yaml @@ -5,6 +5,13 @@ tasks: - name: update pods repo script: .ci/scripts/update_pods.sh infra_step: true # Note infra steps failing prevents "always" from running. + - name: Swift format + script: script/tool_runner.sh + # Non-Swift languages are formatted on Linux builders. + # Skip them on Mac builder to avoid duplication. + args: ["format", "--fail-on-change", "--no-dart", "--no-clang-format", "--no-kotlin", "--no-java" ] + always: true - name: validate iOS and macOS podspecs script: script/tool_runner.sh args: ["podspec-check"] + always: true diff --git a/.ci/targets/repo_checks.yaml b/.ci/targets/repo_checks.yaml index 5989a5efed7..37d9f0a1008 100644 --- a/.ci/targets/repo_checks.yaml +++ b/.ci/targets/repo_checks.yaml @@ -4,7 +4,8 @@ tasks: infra_step: true # Note infra steps failing prevents "always" from running. - name: format script: script/tool_runner.sh - args: ["format", "--fail-on-change"] + # Skip Swift formatting on Linux builders. + args: ["format", "--fail-on-change", "--no-swift"] always: true - name: license validation script: script/tool_runner.sh diff --git a/packages/file_selector/file_selector_macos/example/macos/RunnerTests/RunnerTests.swift b/packages/file_selector/file_selector_macos/example/macos/RunnerTests/RunnerTests.swift index 53081ed6548..304646a9b59 100644 --- a/packages/file_selector/file_selector_macos/example/macos/RunnerTests/RunnerTests.swift +++ b/packages/file_selector/file_selector_macos/example/macos/RunnerTests/RunnerTests.swift @@ -40,7 +40,7 @@ class TestViewProvider: NSObject, ViewProvider { var window: NSWindow? = NSWindow() } -class exampleTests: XCTestCase { +class ExampleTests: XCTestCase { func testOpenSimple() throws { let panelController = TestPanelController() diff --git a/packages/pigeon/tool/shared/generation.dart b/packages/pigeon/tool/shared/generation.dart index 1ae5a45edc3..03952ddbcfd 100644 --- a/packages/pigeon/tool/shared/generation.dart +++ b/packages/pigeon/tool/shared/generation.dart @@ -242,6 +242,7 @@ Future formatAllFiles({required String repositoryRoot}) { 'run', 'script/tool/bin/flutter_plugin_tools.dart', 'format', + '--no-swift', '--packages=pigeon', ], workingDirectory: repositoryRoot, diff --git a/script/tool/lib/src/format_command.dart b/script/tool/lib/src/format_command.dart index aa19bc96af1..c0030949086 100644 --- a/script/tool/lib/src/format_command.dart +++ b/script/tool/lib/src/format_command.dart @@ -54,7 +54,8 @@ class FormatCommand extends PackageCommand { argParser.addFlag(_kotlinArg, help: 'Format Kotlin files', defaultsTo: true); argParser.addFlag(_javaArg, help: 'Format Java files', defaultsTo: true); - argParser.addFlag(_swiftArg, help: 'Format Swift files'); + argParser.addFlag(_swiftArg, + help: 'Format and lint Swift files', defaultsTo: true); argParser.addOption(_clangFormatPathArg, defaultsTo: 'clang-format', help: 'Path to "clang-format" executable.'); argParser.addOption(_javaPathArg, @@ -105,7 +106,7 @@ class FormatCommand extends PackageCommand { await _formatCppAndObjectiveC(files); } if (getBoolArg(_swiftArg)) { - await _formatSwift(files); + await _formatAndLintSwift(files); } if (getBoolArg('fail-on-change')) { @@ -177,16 +178,32 @@ class FormatCommand extends PackageCommand { } } - Future _formatSwift(Iterable files) async { - final String swiftFormat = await _findValidSwiftFormat(); - final Iterable swiftFiles = - _getPathsWithExtensions(files, {'.swift'}); + Future _formatAndLintSwift(Iterable files) async { + // TODO(jmagman): Remove generated file filter when pigeon Swift generation matches swift-format. + // https://github.com/flutter/flutter/issues/141799 + final Iterable swiftFiles = _filterGeneratedFiles( + _getPathsWithExtensions(files, {'.swift'})); if (swiftFiles.isNotEmpty) { + final String swiftFormat = await _findValidSwiftFormat(); print('Formatting .swift files...'); - final int exitCode = + final int formatExitCode = await _runBatched(swiftFormat, ['-i'], files: swiftFiles); - if (exitCode != 0) { - printError('Failed to format Swift files: exit code $exitCode.'); + if (formatExitCode != 0) { + printError('Failed to format Swift files: exit code $formatExitCode.'); + throw ToolExit(_exitSwiftFormatFailed); + } + + print('Linting .swift files...'); + final int lintExitCode = await _runBatched( + swiftFormat, + [ + 'lint', + '--parallel', + '--strict', + ], + files: swiftFiles); + if (lintExitCode != 0) { + printError('Failed to lint Swift files: exit code $lintExitCode.'); throw ToolExit(_exitSwiftFormatFailed); } } @@ -342,6 +359,13 @@ class FormatCommand extends PackageCommand { (String filePath) => extensions.contains(path.extension(filePath))); } + Iterable _filterGeneratedFiles(Iterable files) { + return files.where((String filePath) { + final String basename = path.basename(filePath); + return !basename.contains('.gen.') && !basename.contains('.g.'); + }); + } + Future _getJavaFormatterPath() async { final String javaFormatterPath = path.join( path.dirname(path.fromUri(platform.script)), diff --git a/script/tool/test/format_command_test.dart b/script/tool/test/format_command_test.dart index 73d1864322a..846466e2aad 100644 --- a/script/tool/test/format_command_test.dart +++ b/script/tool/test/format_command_test.dart @@ -551,15 +551,45 @@ void main() { processRunner.recordedCalls, orderedEquals([ const ProcessCall( - '/path/to/swift-format', ['--version'], null), + '/path/to/swift-format', + ['--version'], + null, + ), ProcessCall( - '/path/to/swift-format', - ['-i', ...getPackagesDirRelativePaths(plugin, files)], - packagesDir.path), + '/path/to/swift-format', + ['-i', ...getPackagesDirRelativePaths(plugin, files)], + packagesDir.path, + ), + ProcessCall( + '/path/to/swift-format', + [ + 'lint', + '--parallel', + '--strict', + ...getPackagesDirRelativePaths(plugin, files), + ], + packagesDir.path, + ), ])); }); - test('skips Swift if --swift flag is not provided', () async { + test('skips generated Swift files', () async { + const List files = [ + 'macos/foo.gen.swift', + 'macos/foo.g.swift', + ]; + createFakePlugin( + 'a_plugin', + packagesDir, + extraFiles: files, + ); + + await runCapturingPrint(runner, ['format', '--swift']); + + expect(processRunner.recordedCalls, orderedEquals([])); + }); + + test('skips Swift if --no-swift flag is provided', () async { const List files = [ 'macos/foo.swift', ]; @@ -569,7 +599,7 @@ void main() { extraFiles: files, ); - await runCapturingPrint(runner, ['format']); + await runCapturingPrint(runner, ['format', '--no-swift']); expect(processRunner.recordedCalls, orderedEquals([])); }); @@ -601,6 +631,40 @@ void main() { ])); }); + test('fails if swift-format lint fails', () async { + const List files = [ + 'macos/foo.swift', + ]; + createFakePlugin('a_plugin', packagesDir, extraFiles: files); + + processRunner.mockProcessesForExecutable['swift-format'] = + [ + FakeProcessInfo(MockProcess(), + ['--version']), // check for working swift-format + FakeProcessInfo(MockProcess(), ['-i']), + FakeProcessInfo(MockProcess(exitCode: 1), [ + 'lint', + '--parallel', + '--strict', + ]), + ]; + Error? commandError; + final List output = await runCapturingPrint(runner, [ + 'format', + '--swift', + '--swift-format-path=swift-format' + ], errorHandler: (Error e) { + commandError = e; + }); + + expect(commandError, isA()); + expect( + output, + containsAllInOrder([ + contains('Failed to lint Swift files: exit code 1.'), + ])); + }); + test('fails if swift-format fails', () async { const List files = [ 'macos/foo.swift', From 7b07d187ff08639ccc401a628fb98bc74d054755 Mon Sep 17 00:00:00 2001 From: hellohuanlin <41930132+hellohuanlin@users.noreply.github.com> Date: Fri, 19 Jan 2024 18:22:25 -0800 Subject: [PATCH 06/11] [camera]fix a sample buffer memory leak on pause resume recording (#5927) This memory leak happens when pause/resume the recording. Depending on camera resolution, about 1-2MB leaks for every resume, so it can add up pretty fast if we frequently pause/resume. We only reference this sample buffer inside the scope of this method (e.g. directly piping into file IO), so no need to retain it again, as it's already retained and will be released afterwards by apple. (We did keep around the pixel buffer, but we already manually [retain](https://github.com/flutter/packages/blob/d7ee75ad59ad7bc45e659d0599e935e9e7981ea1/packages/camera/camera_avfoundation/ios/Classes/FLTCam.m#L403) and [release](https://github.com/flutter/packages/blob/d7ee75ad59ad7bc45e659d0599e935e9e7981ea1/packages/camera/camera_avfoundation/ios/Classes/FLTCam.m#L415) that) Bug was introduced in https://github.com/flutter/plugins/pull/1370. *List which issues are fixed by this PR. You must list at least one issue.* https://github.com/flutter/flutter/issues/132013 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* --- .../camera/camera_avfoundation/CHANGELOG.md | 5 +-- .../ios/RunnerTests/FLTCamSampleBufferTests.m | 35 +++++++++++++++++++ .../camera_avfoundation/ios/Classes/FLTCam.m | 15 ++++---- .../camera/camera_avfoundation/pubspec.yaml | 2 +- 4 files changed, 46 insertions(+), 11 deletions(-) diff --git a/packages/camera/camera_avfoundation/CHANGELOG.md b/packages/camera/camera_avfoundation/CHANGELOG.md index b8d61cb0b33..dae480a6b16 100644 --- a/packages/camera/camera_avfoundation/CHANGELOG.md +++ b/packages/camera/camera_avfoundation/CHANGELOG.md @@ -1,6 +1,7 @@ -## NEXT +## 0.9.13+11 -* Remove development team from example app. +* Fixes a memory leak of sample buffer when pause and resume the video recording. +* Removes development team from example app. * Updates minimum iOS version to 12.0 and minimum Flutter version to 3.16.6. ## 0.9.13+10 diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamSampleBufferTests.m b/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamSampleBufferTests.m index 6f0a4edab08..24e35449114 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamSampleBufferTests.m +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamSampleBufferTests.m @@ -38,6 +38,41 @@ - (void)testCopyPixelBuffer { CFRelease(deliveriedPixelBuffer); } +- (void)testDidOutputSampleBuffer_mustNotChangeSampleBufferRetainCountAfterPauseResumeRecording { + FLTCam *cam = FLTCreateCamWithCaptureSessionQueue(dispatch_queue_create("test", NULL)); + CMSampleBufferRef sampleBuffer = FLTCreateTestSampleBuffer(); + + id writerMock = OCMClassMock([AVAssetWriter class]); + OCMStub([writerMock alloc]).andReturn(writerMock); + OCMStub([writerMock initWithURL:OCMOCK_ANY fileType:OCMOCK_ANY error:[OCMArg setTo:nil]]) + .andReturn(writerMock); + __block AVAssetWriterStatus status = AVAssetWriterStatusUnknown; + OCMStub([writerMock startWriting]).andDo(^(NSInvocation *invocation) { + status = AVAssetWriterStatusWriting; + }); + OCMStub([writerMock status]).andDo(^(NSInvocation *invocation) { + [invocation setReturnValue:&status]; + }); + + FLTThreadSafeFlutterResult *result = + [[FLTThreadSafeFlutterResult alloc] initWithResult:^(id result){ + // no-op + }]; + + // Pause then resume the recording. + [cam startVideoRecordingWithResult:result]; + [cam pauseVideoRecordingWithResult:result]; + [cam resumeVideoRecordingWithResult:result]; + + [cam captureOutput:cam.captureVideoOutput + didOutputSampleBuffer:sampleBuffer + fromConnection:OCMClassMock([AVCaptureConnection class])]; + XCTAssertEqual(CFGetRetainCount(sampleBuffer), 1, + @"didOutputSampleBuffer must not change the sample buffer retain count after " + @"pause resume recording."); + CFRelease(sampleBuffer); +} + - (void)testDidOutputSampleBufferIgnoreAudioSamplesBeforeVideoSamples { FLTCam *cam = FLTCreateCamWithCaptureSessionQueue(dispatch_queue_create("testing", NULL)); CMSampleBufferRef videoSample = FLTCreateTestSampleBuffer(); diff --git a/packages/camera/camera_avfoundation/ios/Classes/FLTCam.m b/packages/camera/camera_avfoundation/ios/Classes/FLTCam.m index 1f940403320..b3dd9c53e2b 100644 --- a/packages/camera/camera_avfoundation/ios/Classes/FLTCam.m +++ b/packages/camera/camera_avfoundation/ios/Classes/FLTCam.m @@ -514,7 +514,6 @@ - (void)captureOutput:(AVCaptureOutput *)output return; } - CFRetain(sampleBuffer); CMTime currentSampleTime = CMSampleBufferGetPresentationTimeStamp(sampleBuffer); if (_videoWriter.status != AVAssetWriterStatusWriting) { @@ -564,18 +563,18 @@ - (void)captureOutput:(AVCaptureOutput *)output _lastAudioSampleTime = currentSampleTime; if (_audioTimeOffset.value != 0) { - CFRelease(sampleBuffer); - sampleBuffer = [self adjustTime:sampleBuffer by:_audioTimeOffset]; + CMSampleBufferRef adjustedSampleBuffer = + [self copySampleBufferWithAdjustedTime:sampleBuffer by:_audioTimeOffset]; + [self newAudioSample:adjustedSampleBuffer]; + CFRelease(adjustedSampleBuffer); + } else { + [self newAudioSample:sampleBuffer]; } - - [self newAudioSample:sampleBuffer]; } - - CFRelease(sampleBuffer); } } -- (CMSampleBufferRef)adjustTime:(CMSampleBufferRef)sample by:(CMTime)offset CF_RETURNS_RETAINED { +- (CMSampleBufferRef)copySampleBufferWithAdjustedTime:(CMSampleBufferRef)sample by:(CMTime)offset { CMItemCount count; CMSampleBufferGetSampleTimingInfoArray(sample, 0, nil, &count); CMSampleTimingInfo *pInfo = malloc(sizeof(CMSampleTimingInfo) * count); diff --git a/packages/camera/camera_avfoundation/pubspec.yaml b/packages/camera/camera_avfoundation/pubspec.yaml index 175213883b1..e3845c4f5ea 100644 --- a/packages/camera/camera_avfoundation/pubspec.yaml +++ b/packages/camera/camera_avfoundation/pubspec.yaml @@ -2,7 +2,7 @@ name: camera_avfoundation description: iOS implementation of the camera plugin. repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_avfoundation issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.9.13+10 +version: 0.9.13+11 environment: sdk: ^3.2.3 From 648315fc1e403a12cb48667aa83a7f6b8029cbbb Mon Sep 17 00:00:00 2001 From: engine-flutter-autoroll Date: Sat, 20 Jan 2024 10:46:36 -0500 Subject: [PATCH 07/11] Roll Flutter from 684247a3c78a to ddf60fb08733 (12 revisions) (#5949) https://github.com/flutter/flutter/compare/684247a3c78a...ddf60fb08733 2024-01-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 1385f76018ab to 704ef3399012 (1 revision) (flutter/flutter#141932) 2024-01-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 6f6649bdfef2 to 1385f76018ab (1 revision) (flutter/flutter#141926) 2024-01-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 4d67f267b115 to 6f6649bdfef2 (1 revision) (flutter/flutter#141920) 2024-01-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 53a2436cf75c to 4d67f267b115 (1 revision) (flutter/flutter#141917) 2024-01-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from a9b87c6288d2 to 53a2436cf75c (1 revision) (flutter/flutter#141916) 2024-01-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from d00e55f7f8ed to a9b87c6288d2 (3 revisions) (flutter/flutter#141914) 2024-01-20 31859944+LongCatIsLooong@users.noreply.github.com Remove more textScaleFactor references (flutter/flutter#141816) 2024-01-19 engine-flutter-autoroll@skia.org Roll Flutter Engine from 517fc2bbfa51 to d00e55f7f8ed (1 revision) (flutter/flutter#141909) 2024-01-19 engine-flutter-autoroll@skia.org Roll Flutter Engine from f2b441a26416 to 517fc2bbfa51 (2 revisions) (flutter/flutter#141904) 2024-01-19 tessertaha@gmail.com Fix "Delete" tooltip is shown disabled on chips with `onDeleted` callback (flutter/flutter#141770) 2024-01-19 godofredoc@google.com Run module_test_ios on arm and x64 (flutter/flutter#141815) 2024-01-19 36861262+QuncCccccc@users.noreply.github.com `SearchAnchor` search view clear button only shows up when text input is not empty (flutter/flutter#141755) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC dit@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md --- .ci/flutter_master.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/flutter_master.version b/.ci/flutter_master.version index da43da073d7..ac8efc0789b 100644 --- a/.ci/flutter_master.version +++ b/.ci/flutter_master.version @@ -1 +1 @@ -684247a3c78a1d3e46a4fa54e2c1111c74170951 +ddf60fb087339ed1f886e7091794dde3c0d97d54 From 2b0d290e4a5eb6f9dff67f61bc2f44f17245120a Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Sat, 20 Jan 2024 08:18:33 -0800 Subject: [PATCH 08/11] [pigeon] Improve style of generated Swift code (#5938) Cleans up our Swift output to be more idiomatic (or in a couple of cases to match swift-format` in particular): - Don't indent `case`s in `switch`es. - Remove some stray `;`s - Remove `()`s around `if` conditions - Add trailing newlines in multi-element arrays - Fix some missing standard whitespace in a handful of places where it was missing (after named arguments, between `()` and `{`) - Indent inside `#if` constructs. - Two changes that are more arguable, as it's not clear that they are non-idiomatic vs just non-`swift-format`-style (and they add branching to the generator that would otherwise not be needed): - Don't put a trailing comma on the list element of a one-element list - Don't put `()` on zero-arg method calls with a trailing closure With these changes, as far as can tell the diffs created by `swift-format` are just line wrapping. Fixes https://github.com/flutter/flutter/issues/141799 --- packages/pigeon/CHANGELOG.md | 4 + .../example/app/ios/Runner/Messages.g.swift | 37 +- packages/pigeon/lib/generator_tools.dart | 4 +- packages/pigeon/lib/swift_generator.dart | 38 +- .../ios/Classes/CoreTests.gen.swift | 649 +++++++++--------- .../macos/Classes/CoreTests.gen.swift | 649 +++++++++--------- packages/pigeon/pubspec.yaml | 2 +- .../pigeon/test/swift_generator_test.dart | 30 +- 8 files changed, 723 insertions(+), 690 deletions(-) diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md index 6a901e11287..6c26d0287fd 100644 --- a/packages/pigeon/CHANGELOG.md +++ b/packages/pigeon/CHANGELOG.md @@ -1,3 +1,7 @@ +## 16.0.4 + +* [swift] Improve style of Swift output. + ## 16.0.3 * [kotlin] Separates message call code generation into separate methods. diff --git a/packages/pigeon/example/app/ios/Runner/Messages.g.swift b/packages/pigeon/example/app/ios/Runner/Messages.g.swift index ad6a337a6db..100fa3b7753 100644 --- a/packages/pigeon/example/app/ios/Runner/Messages.g.swift +++ b/packages/pigeon/example/app/ios/Runner/Messages.g.swift @@ -5,12 +5,13 @@ // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif private func wrapResult(_ result: Any?) -> [Any?] { @@ -22,13 +23,13 @@ private func wrapError(_ error: Any) -> [Any?] { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } @@ -83,10 +84,10 @@ struct MessageData { private class ExampleHostApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return MessageData.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return MessageData.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -165,10 +166,10 @@ class ExampleHostApiSetup { let messageArg = args[0] as! MessageData api.sendMessage(message: messageArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -183,7 +184,7 @@ protocol MessageFlutterApiProtocol { } class MessageFlutterApi: MessageFlutterApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } func flutterMethod(aString aStringArg: String?, completion: @escaping (Result) -> Void) { @@ -191,15 +192,15 @@ class MessageFlutterApi: MessageFlutterApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart index 31a4d0e778b..a399c62f1be 100644 --- a/packages/pigeon/lib/generator_tools.dart +++ b/packages/pigeon/lib/generator_tools.dart @@ -13,7 +13,7 @@ import 'ast.dart'; /// The current version of pigeon. /// /// This must match the version in pubspec.yaml. -const String pigeonVersion = '16.0.3'; +const String pigeonVersion = '16.0.4'; /// Read all the content from [stdin] to a String. String readStdin() { @@ -309,7 +309,7 @@ bool isVoid(TypeMirror type) { void addLines(Indent indent, Iterable lines, {String? linePrefix}) { final String prefix = linePrefix ?? ''; for (final String line in lines) { - indent.writeln('$prefix$line'); + indent.writeln(line.isNotEmpty ? '$prefix$line' : prefix.trimRight()); } } diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart index ae869426e62..91319402c4f 100644 --- a/packages/pigeon/lib/swift_generator.dart +++ b/packages/pigeon/lib/swift_generator.dart @@ -76,13 +76,14 @@ class SwiftGenerator extends StructuredGenerator { required String dartPackageName, }) { indent.writeln('import Foundation'); + indent.newln(); indent.format(''' #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif'''); } @@ -160,6 +161,9 @@ import FlutterMacOS indent.addScoped('{', '}', () { indent.write('return '); indent.addScoped('[', ']', () { + // Follow swift-format style, which is to use a trailing comma unless + // there is only one element. + final String separator = classDefinition.fields.length > 1 ? ',' : ''; for (final NamedType field in getFieldsInSerializationOrder(classDefinition)) { String toWriteValue = ''; @@ -173,7 +177,7 @@ import FlutterMacOS toWriteValue = field.name; } - indent.writeln('$toWriteValue,'); + indent.writeln('$toWriteValue$separator'); } }); }); @@ -294,7 +298,7 @@ import FlutterMacOS indent.write('class ${api.name}: ${api.name}Protocol '); indent.addScoped('{', '}', () { indent.writeln('private let binaryMessenger: FlutterBinaryMessenger'); - indent.write('init(binaryMessenger: FlutterBinaryMessenger)'); + indent.write('init(binaryMessenger: FlutterBinaryMessenger) '); indent.addScoped('{', '}', () { indent.writeln('self.binaryMessenger = binaryMessenger'); }); @@ -330,20 +334,20 @@ import FlutterMacOS indent.writeScoped( 'guard let listResponse = response as? [Any?] else {', '}', () { indent.writeln( - 'completion(.failure(createConnectionError(withChannelName:channelName)))'); + 'completion(.failure(createConnectionError(withChannelName: channelName)))'); indent.writeln('return'); }); - indent.writeScoped('if (listResponse.count > 1) {', '} ', () { + indent.writeScoped('if listResponse.count > 1 {', '} ', () { indent.writeln('let code: String = listResponse[0] as! String'); indent.writeln( 'let message: String? = nilOrValue(listResponse[1])'); indent.writeln( 'let details: String? = nilOrValue(listResponse[2])'); indent.writeln( - 'completion(.failure(FlutterError(code: code, message: message, details: details)));'); + 'completion(.failure(FlutterError(code: code, message: message, details: details)))'); }, addTrailingNewline: false); if (!func.returnType.isNullable && !func.returnType.isVoid) { - indent.addScoped('else if (listResponse[0] == nil) {', '} ', () { + indent.addScoped('else if listResponse[0] == nil {', '} ', () { indent.writeln( 'completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: "")))'); }, addTrailingNewline: false); @@ -495,8 +499,14 @@ import FlutterMacOS }); } final String tryStatement = method.isAsynchronous ? '' : 'try '; + // Empty parens are not required when calling a method whose only + // argument is a trailing closure. + final String argumentString = + methodArgument.isEmpty && method.isAsynchronous + ? '' + : '(${methodArgument.join(', ')})'; final String call = - '${tryStatement}api.${components.name}(${methodArgument.join(', ')})'; + '${tryStatement}api.${components.name}$argumentString'; if (method.isAsynchronous) { final String resultName = method.returnType.isVoid ? 'nil' : 'res'; @@ -506,7 +516,7 @@ import FlutterMacOS indent.addScoped('{ result in', '}', () { indent.write('switch result '); - indent.addScoped('{', '}', () { + indent.addScoped('{', '}', nestCount: 0, () { final String nullsafe = method.returnType.isNullable ? '?' : ''; final String enumTag = @@ -573,7 +583,7 @@ import FlutterMacOS indent.write('override func readValue(ofType type: UInt8) -> Any? '); indent.addScoped('{', '}', () { indent.write('switch type '); - indent.addScoped('{', '}', () { + indent.addScoped('{', '}', nestCount: 0, () { for (final EnumeratedClass customClass in getCodecClasses(api, root)) { indent.writeln('case ${customClass.enumeration}:'); @@ -764,14 +774,14 @@ import FlutterMacOS indent.addScoped('[', ']', () { indent.writeln('flutterError.code,'); indent.writeln('flutterError.message,'); - indent.writeln('flutterError.details'); + indent.writeln('flutterError.details,'); }); }); indent.write('return '); indent.addScoped('[', ']', () { indent.writeln(r'"\(error)",'); indent.writeln(r'"\(type(of: error))",'); - indent.writeln(r'"Stacktrace: \(Thread.callStackSymbols)"'); + indent.writeln(r'"Stacktrace: \(Thread.callStackSymbols)",'); }); }); } diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift index 773b6e5c12e..4dd101c0ccc 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift @@ -1,17 +1,18 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// +// // Autogenerated from Pigeon, do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif private func wrapResult(_ result: Any?) -> [Any?] { @@ -23,13 +24,13 @@ private func wrapError(_ error: Any) -> [Any?] { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } @@ -250,7 +251,7 @@ struct TestMessage { } func toList() -> [Any?] { return [ - testList, + testList ] } } @@ -258,16 +259,16 @@ struct TestMessage { private class HostIntegrationCoreApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return AllClassesWrapper.fromList(self.readValue() as! [Any?]) - case 129: - return AllNullableTypes.fromList(self.readValue() as! [Any?]) - case 130: - return AllTypes.fromList(self.readValue() as! [Any?]) - case 131: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + case 129: + return AllNullableTypes.fromList(self.readValue() as! [Any?]) + case 130: + return AllTypes.fromList(self.readValue() as! [Any?]) + case 131: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -987,12 +988,12 @@ class HostIntegrationCoreApiSetup { let noopAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopAsyncChannel.setMessageHandler { _, reply in - api.noopAsync() { result in + api.noopAsync { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1007,10 +1008,10 @@ class HostIntegrationCoreApiSetup { let anIntArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) api.echoAsync(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1025,10 +1026,10 @@ class HostIntegrationCoreApiSetup { let aDoubleArg = args[0] as! Double api.echoAsync(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1043,10 +1044,10 @@ class HostIntegrationCoreApiSetup { let aBoolArg = args[0] as! Bool api.echoAsync(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1061,10 +1062,10 @@ class HostIntegrationCoreApiSetup { let aStringArg = args[0] as! String api.echoAsync(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1079,10 +1080,10 @@ class HostIntegrationCoreApiSetup { let aUint8ListArg = args[0] as! FlutterStandardTypedData api.echoAsync(aUint8ListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1097,10 +1098,10 @@ class HostIntegrationCoreApiSetup { let anObjectArg = args[0]! api.echoAsync(anObjectArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1115,10 +1116,10 @@ class HostIntegrationCoreApiSetup { let aListArg = args[0] as! [Any?] api.echoAsync(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1133,10 +1134,10 @@ class HostIntegrationCoreApiSetup { let aMapArg = args[0] as! [String?: Any?] api.echoAsync(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1151,10 +1152,10 @@ class HostIntegrationCoreApiSetup { let anEnumArg = AnEnum(rawValue: args[0] as! Int)! api.echoAsync(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1165,12 +1166,12 @@ class HostIntegrationCoreApiSetup { let throwAsyncErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorChannel.setMessageHandler { _, reply in - api.throwAsyncError() { result in + api.throwAsyncError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1181,12 +1182,12 @@ class HostIntegrationCoreApiSetup { let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorFromVoidChannel.setMessageHandler { _, reply in - api.throwAsyncErrorFromVoid() { result in + api.throwAsyncErrorFromVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1197,12 +1198,12 @@ class HostIntegrationCoreApiSetup { let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncFlutterErrorChannel.setMessageHandler { _, reply in - api.throwAsyncFlutterError() { result in + api.throwAsyncFlutterError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1217,10 +1218,10 @@ class HostIntegrationCoreApiSetup { let everythingArg = args[0] as! AllTypes api.echoAsync(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1235,10 +1236,10 @@ class HostIntegrationCoreApiSetup { let everythingArg: AllNullableTypes? = nilOrValue(args[0]) api.echoAsync(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1253,10 +1254,10 @@ class HostIntegrationCoreApiSetup { let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.echoAsyncNullable(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1271,10 +1272,10 @@ class HostIntegrationCoreApiSetup { let aDoubleArg: Double? = nilOrValue(args[0]) api.echoAsyncNullable(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1289,10 +1290,10 @@ class HostIntegrationCoreApiSetup { let aBoolArg: Bool? = nilOrValue(args[0]) api.echoAsyncNullable(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1307,10 +1308,10 @@ class HostIntegrationCoreApiSetup { let aStringArg: String? = nilOrValue(args[0]) api.echoAsyncNullable(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1325,10 +1326,10 @@ class HostIntegrationCoreApiSetup { let aUint8ListArg: FlutterStandardTypedData? = nilOrValue(args[0]) api.echoAsyncNullable(aUint8ListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1343,10 +1344,10 @@ class HostIntegrationCoreApiSetup { let anObjectArg: Any? = args[0] api.echoAsyncNullable(anObjectArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1361,10 +1362,10 @@ class HostIntegrationCoreApiSetup { let aListArg: [Any?]? = nilOrValue(args[0]) api.echoAsyncNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1379,10 +1380,10 @@ class HostIntegrationCoreApiSetup { let aMapArg: [String?: Any?]? = nilOrValue(args[0]) api.echoAsyncNullable(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1397,10 +1398,10 @@ class HostIntegrationCoreApiSetup { let anEnumArg: AnEnum? = isNullish(args[0]) ? nil : AnEnum(rawValue: args[0] as! Int)! api.echoAsyncNullable(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res?.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res?.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1410,12 +1411,12 @@ class HostIntegrationCoreApiSetup { let callFlutterNoopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterNoopChannel.setMessageHandler { _, reply in - api.callFlutterNoop() { result in + api.callFlutterNoop { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1425,12 +1426,12 @@ class HostIntegrationCoreApiSetup { let callFlutterThrowErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorChannel.setMessageHandler { _, reply in - api.callFlutterThrowError() { result in + api.callFlutterThrowError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1440,12 +1441,12 @@ class HostIntegrationCoreApiSetup { let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorFromVoidChannel.setMessageHandler { _, reply in - api.callFlutterThrowErrorFromVoid() { result in + api.callFlutterThrowErrorFromVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1459,10 +1460,10 @@ class HostIntegrationCoreApiSetup { let everythingArg = args[0] as! AllTypes api.callFlutterEcho(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1476,10 +1477,10 @@ class HostIntegrationCoreApiSetup { let everythingArg: AllNullableTypes? = nilOrValue(args[0]) api.callFlutterEcho(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1495,10 +1496,10 @@ class HostIntegrationCoreApiSetup { let aNullableStringArg: String? = nilOrValue(args[2]) api.callFlutterSendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1512,10 +1513,10 @@ class HostIntegrationCoreApiSetup { let aBoolArg = args[0] as! Bool api.callFlutterEcho(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1529,10 +1530,10 @@ class HostIntegrationCoreApiSetup { let anIntArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) api.callFlutterEcho(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1546,10 +1547,10 @@ class HostIntegrationCoreApiSetup { let aDoubleArg = args[0] as! Double api.callFlutterEcho(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1563,10 +1564,10 @@ class HostIntegrationCoreApiSetup { let aStringArg = args[0] as! String api.callFlutterEcho(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1580,10 +1581,10 @@ class HostIntegrationCoreApiSetup { let aListArg = args[0] as! FlutterStandardTypedData api.callFlutterEcho(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1597,10 +1598,10 @@ class HostIntegrationCoreApiSetup { let aListArg = args[0] as! [Any?] api.callFlutterEcho(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1614,10 +1615,10 @@ class HostIntegrationCoreApiSetup { let aMapArg = args[0] as! [String?: Any?] api.callFlutterEcho(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1631,10 +1632,10 @@ class HostIntegrationCoreApiSetup { let anEnumArg = AnEnum(rawValue: args[0] as! Int)! api.callFlutterEcho(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1648,10 +1649,10 @@ class HostIntegrationCoreApiSetup { let aBoolArg: Bool? = nilOrValue(args[0]) api.callFlutterEchoNullable(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1665,10 +1666,10 @@ class HostIntegrationCoreApiSetup { let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.callFlutterEchoNullable(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1682,10 +1683,10 @@ class HostIntegrationCoreApiSetup { let aDoubleArg: Double? = nilOrValue(args[0]) api.callFlutterEchoNullable(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1699,10 +1700,10 @@ class HostIntegrationCoreApiSetup { let aStringArg: String? = nilOrValue(args[0]) api.callFlutterEchoNullable(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1716,10 +1717,10 @@ class HostIntegrationCoreApiSetup { let aListArg: FlutterStandardTypedData? = nilOrValue(args[0]) api.callFlutterEchoNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1733,10 +1734,10 @@ class HostIntegrationCoreApiSetup { let aListArg: [Any?]? = nilOrValue(args[0]) api.callFlutterEchoNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1750,10 +1751,10 @@ class HostIntegrationCoreApiSetup { let aMapArg: [String?: Any?]? = nilOrValue(args[0]) api.callFlutterEchoNullable(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1767,10 +1768,10 @@ class HostIntegrationCoreApiSetup { let anEnumArg: AnEnum? = isNullish(args[0]) ? nil : AnEnum(rawValue: args[0] as! Int)! api.callFlutterNullableEcho(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res?.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res?.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1782,16 +1783,16 @@ class HostIntegrationCoreApiSetup { private class FlutterIntegrationCoreApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return AllClassesWrapper.fromList(self.readValue() as! [Any?]) - case 129: - return AllNullableTypes.fromList(self.readValue() as! [Any?]) - case 130: - return AllTypes.fromList(self.readValue() as! [Any?]) - case 131: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + case 129: + return AllNullableTypes.fromList(self.readValue() as! [Any?]) + case 130: + return AllTypes.fromList(self.readValue() as! [Any?]) + case 131: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -1890,7 +1891,7 @@ protocol FlutterIntegrationCoreApiProtocol { } class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } var codec: FlutterStandardMessageCodec { @@ -1903,14 +1904,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } @@ -1922,14 +1923,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Any? = listResponse[0] completion(.success(result)) @@ -1942,14 +1943,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } @@ -1961,15 +1962,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllTypes @@ -1983,14 +1984,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: AllNullableTypes? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2005,15 +2006,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllNullableTypes @@ -2027,15 +2028,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Bool @@ -2049,15 +2050,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) @@ -2071,15 +2072,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Double @@ -2093,15 +2094,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String @@ -2115,15 +2116,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! FlutterStandardTypedData @@ -2137,15 +2138,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [Any?] @@ -2159,15 +2160,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [String?: Any?] @@ -2181,15 +2182,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = AnEnum(rawValue: listResponse[0] as! Int)! @@ -2203,14 +2204,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Bool? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2223,14 +2224,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Int64? = isNullish(listResponse[0]) ? nil : (listResponse[0] is Int64? ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) completion(.success(result)) @@ -2243,14 +2244,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Double? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2263,14 +2264,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: String? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2283,14 +2284,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: FlutterStandardTypedData? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2303,14 +2304,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: [Any?]? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2323,14 +2324,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: [String?: Any?]? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2343,14 +2344,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg?.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: AnEnum? = isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) @@ -2364,14 +2365,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } @@ -2383,15 +2384,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String @@ -2447,10 +2448,10 @@ class HostSmallApiSetup { let aStringArg = args[0] as! String api.echo(aString: aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -2460,12 +2461,12 @@ class HostSmallApiSetup { let voidVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", binaryMessenger: binaryMessenger) if let api = api { voidVoidChannel.setMessageHandler { _, reply in - api.voidVoid() { result in + api.voidVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -2477,10 +2478,10 @@ class HostSmallApiSetup { private class FlutterSmallApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -2519,7 +2520,7 @@ protocol FlutterSmallApiProtocol { } class FlutterSmallApi: FlutterSmallApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } var codec: FlutterStandardMessageCodec { @@ -2530,15 +2531,15 @@ class FlutterSmallApi: FlutterSmallApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([msgArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! TestMessage @@ -2551,15 +2552,15 @@ class FlutterSmallApi: FlutterSmallApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift index 773b6e5c12e..4dd101c0ccc 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift @@ -1,17 +1,18 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// +// // Autogenerated from Pigeon, do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif private func wrapResult(_ result: Any?) -> [Any?] { @@ -23,13 +24,13 @@ private func wrapError(_ error: Any) -> [Any?] { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } @@ -250,7 +251,7 @@ struct TestMessage { } func toList() -> [Any?] { return [ - testList, + testList ] } } @@ -258,16 +259,16 @@ struct TestMessage { private class HostIntegrationCoreApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return AllClassesWrapper.fromList(self.readValue() as! [Any?]) - case 129: - return AllNullableTypes.fromList(self.readValue() as! [Any?]) - case 130: - return AllTypes.fromList(self.readValue() as! [Any?]) - case 131: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + case 129: + return AllNullableTypes.fromList(self.readValue() as! [Any?]) + case 130: + return AllTypes.fromList(self.readValue() as! [Any?]) + case 131: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -987,12 +988,12 @@ class HostIntegrationCoreApiSetup { let noopAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopAsyncChannel.setMessageHandler { _, reply in - api.noopAsync() { result in + api.noopAsync { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1007,10 +1008,10 @@ class HostIntegrationCoreApiSetup { let anIntArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) api.echoAsync(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1025,10 +1026,10 @@ class HostIntegrationCoreApiSetup { let aDoubleArg = args[0] as! Double api.echoAsync(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1043,10 +1044,10 @@ class HostIntegrationCoreApiSetup { let aBoolArg = args[0] as! Bool api.echoAsync(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1061,10 +1062,10 @@ class HostIntegrationCoreApiSetup { let aStringArg = args[0] as! String api.echoAsync(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1079,10 +1080,10 @@ class HostIntegrationCoreApiSetup { let aUint8ListArg = args[0] as! FlutterStandardTypedData api.echoAsync(aUint8ListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1097,10 +1098,10 @@ class HostIntegrationCoreApiSetup { let anObjectArg = args[0]! api.echoAsync(anObjectArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1115,10 +1116,10 @@ class HostIntegrationCoreApiSetup { let aListArg = args[0] as! [Any?] api.echoAsync(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1133,10 +1134,10 @@ class HostIntegrationCoreApiSetup { let aMapArg = args[0] as! [String?: Any?] api.echoAsync(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1151,10 +1152,10 @@ class HostIntegrationCoreApiSetup { let anEnumArg = AnEnum(rawValue: args[0] as! Int)! api.echoAsync(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1165,12 +1166,12 @@ class HostIntegrationCoreApiSetup { let throwAsyncErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorChannel.setMessageHandler { _, reply in - api.throwAsyncError() { result in + api.throwAsyncError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1181,12 +1182,12 @@ class HostIntegrationCoreApiSetup { let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorFromVoidChannel.setMessageHandler { _, reply in - api.throwAsyncErrorFromVoid() { result in + api.throwAsyncErrorFromVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1197,12 +1198,12 @@ class HostIntegrationCoreApiSetup { let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncFlutterErrorChannel.setMessageHandler { _, reply in - api.throwAsyncFlutterError() { result in + api.throwAsyncFlutterError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1217,10 +1218,10 @@ class HostIntegrationCoreApiSetup { let everythingArg = args[0] as! AllTypes api.echoAsync(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1235,10 +1236,10 @@ class HostIntegrationCoreApiSetup { let everythingArg: AllNullableTypes? = nilOrValue(args[0]) api.echoAsync(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1253,10 +1254,10 @@ class HostIntegrationCoreApiSetup { let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.echoAsyncNullable(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1271,10 +1272,10 @@ class HostIntegrationCoreApiSetup { let aDoubleArg: Double? = nilOrValue(args[0]) api.echoAsyncNullable(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1289,10 +1290,10 @@ class HostIntegrationCoreApiSetup { let aBoolArg: Bool? = nilOrValue(args[0]) api.echoAsyncNullable(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1307,10 +1308,10 @@ class HostIntegrationCoreApiSetup { let aStringArg: String? = nilOrValue(args[0]) api.echoAsyncNullable(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1325,10 +1326,10 @@ class HostIntegrationCoreApiSetup { let aUint8ListArg: FlutterStandardTypedData? = nilOrValue(args[0]) api.echoAsyncNullable(aUint8ListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1343,10 +1344,10 @@ class HostIntegrationCoreApiSetup { let anObjectArg: Any? = args[0] api.echoAsyncNullable(anObjectArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1361,10 +1362,10 @@ class HostIntegrationCoreApiSetup { let aListArg: [Any?]? = nilOrValue(args[0]) api.echoAsyncNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1379,10 +1380,10 @@ class HostIntegrationCoreApiSetup { let aMapArg: [String?: Any?]? = nilOrValue(args[0]) api.echoAsyncNullable(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1397,10 +1398,10 @@ class HostIntegrationCoreApiSetup { let anEnumArg: AnEnum? = isNullish(args[0]) ? nil : AnEnum(rawValue: args[0] as! Int)! api.echoAsyncNullable(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res?.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res?.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1410,12 +1411,12 @@ class HostIntegrationCoreApiSetup { let callFlutterNoopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterNoopChannel.setMessageHandler { _, reply in - api.callFlutterNoop() { result in + api.callFlutterNoop { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1425,12 +1426,12 @@ class HostIntegrationCoreApiSetup { let callFlutterThrowErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorChannel.setMessageHandler { _, reply in - api.callFlutterThrowError() { result in + api.callFlutterThrowError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1440,12 +1441,12 @@ class HostIntegrationCoreApiSetup { let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorFromVoidChannel.setMessageHandler { _, reply in - api.callFlutterThrowErrorFromVoid() { result in + api.callFlutterThrowErrorFromVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1459,10 +1460,10 @@ class HostIntegrationCoreApiSetup { let everythingArg = args[0] as! AllTypes api.callFlutterEcho(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1476,10 +1477,10 @@ class HostIntegrationCoreApiSetup { let everythingArg: AllNullableTypes? = nilOrValue(args[0]) api.callFlutterEcho(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1495,10 +1496,10 @@ class HostIntegrationCoreApiSetup { let aNullableStringArg: String? = nilOrValue(args[2]) api.callFlutterSendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1512,10 +1513,10 @@ class HostIntegrationCoreApiSetup { let aBoolArg = args[0] as! Bool api.callFlutterEcho(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1529,10 +1530,10 @@ class HostIntegrationCoreApiSetup { let anIntArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) api.callFlutterEcho(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1546,10 +1547,10 @@ class HostIntegrationCoreApiSetup { let aDoubleArg = args[0] as! Double api.callFlutterEcho(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1563,10 +1564,10 @@ class HostIntegrationCoreApiSetup { let aStringArg = args[0] as! String api.callFlutterEcho(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1580,10 +1581,10 @@ class HostIntegrationCoreApiSetup { let aListArg = args[0] as! FlutterStandardTypedData api.callFlutterEcho(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1597,10 +1598,10 @@ class HostIntegrationCoreApiSetup { let aListArg = args[0] as! [Any?] api.callFlutterEcho(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1614,10 +1615,10 @@ class HostIntegrationCoreApiSetup { let aMapArg = args[0] as! [String?: Any?] api.callFlutterEcho(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1631,10 +1632,10 @@ class HostIntegrationCoreApiSetup { let anEnumArg = AnEnum(rawValue: args[0] as! Int)! api.callFlutterEcho(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1648,10 +1649,10 @@ class HostIntegrationCoreApiSetup { let aBoolArg: Bool? = nilOrValue(args[0]) api.callFlutterEchoNullable(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1665,10 +1666,10 @@ class HostIntegrationCoreApiSetup { let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.callFlutterEchoNullable(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1682,10 +1683,10 @@ class HostIntegrationCoreApiSetup { let aDoubleArg: Double? = nilOrValue(args[0]) api.callFlutterEchoNullable(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1699,10 +1700,10 @@ class HostIntegrationCoreApiSetup { let aStringArg: String? = nilOrValue(args[0]) api.callFlutterEchoNullable(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1716,10 +1717,10 @@ class HostIntegrationCoreApiSetup { let aListArg: FlutterStandardTypedData? = nilOrValue(args[0]) api.callFlutterEchoNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1733,10 +1734,10 @@ class HostIntegrationCoreApiSetup { let aListArg: [Any?]? = nilOrValue(args[0]) api.callFlutterEchoNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1750,10 +1751,10 @@ class HostIntegrationCoreApiSetup { let aMapArg: [String?: Any?]? = nilOrValue(args[0]) api.callFlutterEchoNullable(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1767,10 +1768,10 @@ class HostIntegrationCoreApiSetup { let anEnumArg: AnEnum? = isNullish(args[0]) ? nil : AnEnum(rawValue: args[0] as! Int)! api.callFlutterNullableEcho(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res?.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res?.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1782,16 +1783,16 @@ class HostIntegrationCoreApiSetup { private class FlutterIntegrationCoreApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return AllClassesWrapper.fromList(self.readValue() as! [Any?]) - case 129: - return AllNullableTypes.fromList(self.readValue() as! [Any?]) - case 130: - return AllTypes.fromList(self.readValue() as! [Any?]) - case 131: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + case 129: + return AllNullableTypes.fromList(self.readValue() as! [Any?]) + case 130: + return AllTypes.fromList(self.readValue() as! [Any?]) + case 131: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -1890,7 +1891,7 @@ protocol FlutterIntegrationCoreApiProtocol { } class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } var codec: FlutterStandardMessageCodec { @@ -1903,14 +1904,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } @@ -1922,14 +1923,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Any? = listResponse[0] completion(.success(result)) @@ -1942,14 +1943,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } @@ -1961,15 +1962,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllTypes @@ -1983,14 +1984,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: AllNullableTypes? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2005,15 +2006,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllNullableTypes @@ -2027,15 +2028,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Bool @@ -2049,15 +2050,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) @@ -2071,15 +2072,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Double @@ -2093,15 +2094,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String @@ -2115,15 +2116,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! FlutterStandardTypedData @@ -2137,15 +2138,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [Any?] @@ -2159,15 +2160,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [String?: Any?] @@ -2181,15 +2182,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = AnEnum(rawValue: listResponse[0] as! Int)! @@ -2203,14 +2204,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Bool? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2223,14 +2224,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Int64? = isNullish(listResponse[0]) ? nil : (listResponse[0] is Int64? ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) completion(.success(result)) @@ -2243,14 +2244,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Double? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2263,14 +2264,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: String? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2283,14 +2284,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: FlutterStandardTypedData? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2303,14 +2304,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: [Any?]? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2323,14 +2324,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: [String?: Any?]? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2343,14 +2344,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg?.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: AnEnum? = isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) @@ -2364,14 +2365,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } @@ -2383,15 +2384,15 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String @@ -2447,10 +2448,10 @@ class HostSmallApiSetup { let aStringArg = args[0] as! String api.echo(aString: aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -2460,12 +2461,12 @@ class HostSmallApiSetup { let voidVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", binaryMessenger: binaryMessenger) if let api = api { voidVoidChannel.setMessageHandler { _, reply in - api.voidVoid() { result in + api.voidVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -2477,10 +2478,10 @@ class HostSmallApiSetup { private class FlutterSmallApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -2519,7 +2520,7 @@ protocol FlutterSmallApiProtocol { } class FlutterSmallApi: FlutterSmallApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } var codec: FlutterStandardMessageCodec { @@ -2530,15 +2531,15 @@ class FlutterSmallApi: FlutterSmallApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([msgArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! TestMessage @@ -2551,15 +2552,15 @@ class FlutterSmallApi: FlutterSmallApiProtocol { let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index c6029d4ed30..6ac3bb29449 100644 --- a/packages/pigeon/pubspec.yaml +++ b/packages/pigeon/pubspec.yaml @@ -2,7 +2,7 @@ name: pigeon description: Code generator tool to make communication between Flutter and the host platform type-safe and easier. repository: https://github.com/flutter/packages/tree/main/packages/pigeon issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pigeon%22 -version: 16.0.3 # This must match the version in lib/generator_tools.dart +version: 16.0.4 # This must match the version in lib/generator_tools.dart environment: sdk: ">=3.0.0 <4.0.0" diff --git a/packages/pigeon/test/swift_generator_test.dart b/packages/pigeon/test/swift_generator_test.dart index 4c07b784eb7..b39909be32b 100644 --- a/packages/pigeon/test/swift_generator_test.dart +++ b/packages/pigeon/test/swift_generator_test.dart @@ -52,6 +52,7 @@ void main() { expect(code, contains('var field1: Int64? = nil')); expect(code, contains('static func fromList(_ list: [Any?]) -> Foobar?')); expect(code, contains('func toList() -> [Any?]')); + expect(code, isNot(contains('if ('))); }); test('gen one enum', () { @@ -80,6 +81,7 @@ void main() { expect(code, contains('enum Foobar: Int')); expect(code, contains(' case one = 0')); expect(code, contains(' case two = 1')); + expect(code, isNot(contains('if ('))); }); test('primitive enum host', () { @@ -116,6 +118,7 @@ void main() { final String code = sink.toString(); expect(code, contains('enum Foo: Int')); expect(code, contains('let fooArg = Foo(rawValue: args[0] as! Int)!')); + expect(code, isNot(contains('if ('))); }); test('gen one host api', () { @@ -170,6 +173,7 @@ void main() { expect(code, contains('protocol Api')); expect(code, matches('func doSomething.*Input.*Output')); expect(code, contains('doSomethingChannel.setMessageHandler')); + expect(code, isNot(contains('if ('))); }); test('all the simple datatypes header', () { @@ -298,6 +302,8 @@ void main() { expect(code, contains('class Api')); expect(code, contains('init(binaryMessenger: FlutterBinaryMessenger)')); expect(code, matches('func doSomething.*Input.*Output')); + expect(code, isNot(contains('if ('))); + expect(code, isNot(matches(RegExp(r';$', multiLine: true)))); }); test('gen host void api', () { @@ -339,6 +345,7 @@ void main() { final String code = sink.toString(); expect(code, isNot(matches('.*doSomething(.*) ->'))); expect(code, matches('doSomething(.*)')); + expect(code, isNot(contains('if ('))); }); test('gen flutter void return api', () { @@ -381,6 +388,7 @@ void main() { expect(code, contains('completion: @escaping (Result) -> Void')); expect(code, contains('completion(.success(Void()))')); + expect(code, isNot(contains('if ('))); }); test('gen host void argument api', () { @@ -419,6 +427,7 @@ void main() { expect(code, contains('func doSomething() throws -> Output')); expect(code, contains('let result = try api.doSomething()')); expect(code, contains('reply(wrapResult(result))')); + expect(code, isNot(contains('if ('))); }); test('gen flutter void argument api', () { @@ -459,6 +468,7 @@ void main() { contains( 'func doSomething(completion: @escaping (Result) -> Void)')); expect(code, contains('channel.sendMessage(nil')); + expect(code, isNot(contains('if ('))); }); test('gen list', () { @@ -484,6 +494,7 @@ void main() { final String code = sink.toString(); expect(code, contains('struct Foobar')); expect(code, contains('var field1: [Any?]? = nil')); + expect(code, isNot(contains('if ('))); }); test('gen map', () { @@ -509,6 +520,7 @@ void main() { final String code = sink.toString(); expect(code, contains('struct Foobar')); expect(code, contains('var field1: [AnyHashable: Any?]? = nil')); + expect(code, isNot(contains('if ('))); }); test('gen nested', () { @@ -556,6 +568,9 @@ void main() { expect(code, contains('static func fromList(_ list: [Any?]) -> Outer?')); expect(code, contains('nested = Nested.fromList(nestedList)')); expect(code, contains('func toList() -> [Any?]')); + expect(code, isNot(contains('if ('))); + // Single-element list serializations should not have a trailing comma. + expect(code, matches(RegExp(r'return \[\s*data\s*]'))); }); test('gen one async Host Api', () { @@ -611,6 +626,7 @@ void main() { expect(code, contains('protocol Api')); expect(code, contains('api.doSomething(arg: argArg) { result in')); expect(code, contains('reply(wrapResult(res))')); + expect(code, isNot(contains('if ('))); }); test('gen one async Flutter Api', () { @@ -665,6 +681,7 @@ void main() { final String code = sink.toString(); expect(code, contains('class Api')); expect(code, matches('func doSomething.*Input.*completion.*Output.*Void')); + expect(code, isNot(contains('if ('))); }); test('gen one enum class', () { @@ -705,17 +722,14 @@ void main() { expect(code, contains('enum Enum1: Int')); expect(code, contains('case one = 0')); expect(code, contains('case two = 1')); + expect(code, isNot(contains('if ('))); }); - Iterable makeIterable(String string) sync* { - yield string; - } - test('header', () { final Root root = Root(apis: [], classes: [], enums: []); final StringBuffer sink = StringBuffer(); - final SwiftOptions swiftOptions = SwiftOptions( - copyrightHeader: makeIterable('hello world'), + const SwiftOptions swiftOptions = SwiftOptions( + copyrightHeader: ['hello world', ''], ); const SwiftGenerator generator = SwiftGenerator(); generator.generate( @@ -726,6 +740,8 @@ void main() { ); final String code = sink.toString(); expect(code, startsWith('// hello world')); + // There should be no trailing whitespace on generated comments. + expect(code, isNot(matches(RegExp(r'^//.* $', multiLine: true)))); }); test('generics - list', () { @@ -1522,7 +1538,7 @@ void main() { expect( code, contains( - 'completion(.failure(createConnectionError(withChannelName:channelName)))')); + 'completion(.failure(createConnectionError(withChannelName: channelName)))')); expect( code, contains( From 2bb7d14d9202ec312d3efa42026be52d49b05c36 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Sat, 20 Jan 2024 12:48:17 -0800 Subject: [PATCH 09/11] [pigeon] Support other hosts in generated file CI checks (#5944) Reworks Pigeon's CI validation of generated files to support multiple hosts, rather than only Linux, with the ability to set specific languages per host, to allow us to run validation for each language on whatever host it is most convenient to set up a formatter for that language, rather than having to support all languages on Linux. See discussion in https://github.com/flutter/packages/pull/5928 Part of https://github.com/flutter/flutter/issues/41129 --- .../example/app/ios/Runner/Messages.g.swift | 32 +- .../ios/Classes/CoreTests.gen.swift | 837 +++++++++++++----- .../macos/Classes/CoreTests.gen.swift | 837 +++++++++++++----- packages/pigeon/tool/run_tests.dart | 140 +-- packages/pigeon/tool/shared/generation.dart | 65 +- .../ios/Classes/messages.g.swift | 40 +- script/tool/lib/src/format_command.dart | 13 +- script/tool/test/format_command_test.dart | 16 - 8 files changed, 1424 insertions(+), 556 deletions(-) diff --git a/packages/pigeon/example/app/ios/Runner/Messages.g.swift b/packages/pigeon/example/app/ios/Runner/Messages.g.swift index 100fa3b7753..3acc38b2cb6 100644 --- a/packages/pigeon/example/app/ios/Runner/Messages.g.swift +++ b/packages/pigeon/example/app/ios/Runner/Messages.g.swift @@ -34,7 +34,9 @@ private func wrapError(_ error: Any) -> [Any?] { } private func createConnectionError(withChannelName channelName: String) -> FlutterError { - return FlutterError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") + return FlutterError( + code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", + details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -130,7 +132,9 @@ class ExampleHostApiSetup { static var codec: FlutterStandardMessageCodec { ExampleHostApiCodec.shared } /// Sets up an instance of `ExampleHostApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: ExampleHostApi?) { - let getHostLanguageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.getHostLanguage", binaryMessenger: binaryMessenger, codec: codec) + let getHostLanguageChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.getHostLanguage", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getHostLanguageChannel.setMessageHandler { _, reply in do { @@ -143,7 +147,9 @@ class ExampleHostApiSetup { } else { getHostLanguageChannel.setMessageHandler(nil) } - let addChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.add", binaryMessenger: binaryMessenger, codec: codec) + let addChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.add", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { addChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -159,7 +165,9 @@ class ExampleHostApiSetup { } else { addChannel.setMessageHandler(nil) } - let sendMessageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.sendMessage", binaryMessenger: binaryMessenger, codec: codec) + let sendMessageChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.sendMessage", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { sendMessageChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -180,15 +188,19 @@ class ExampleHostApiSetup { } /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol MessageFlutterApiProtocol { - func flutterMethod(aString aStringArg: String?, completion: @escaping (Result) -> Void) + func flutterMethod( + aString aStringArg: String?, completion: @escaping (Result) -> Void) } class MessageFlutterApi: MessageFlutterApiProtocol { private let binaryMessenger: FlutterBinaryMessenger init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } - func flutterMethod(aString aStringArg: String?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_example_package.MessageFlutterApi.flutterMethod" + func flutterMethod( + aString aStringArg: String?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_example_package.MessageFlutterApi.flutterMethod" let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { @@ -201,7 +213,11 @@ class MessageFlutterApi: MessageFlutterApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift index 4dd101c0ccc..14bcb9a4113 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift @@ -35,7 +35,9 @@ private func wrapError(_ error: Any) -> [Any?] { } private func createConnectionError(withChannelName channelName: String) -> FlutterError { - return FlutterError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") + return FlutterError( + code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", + details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -144,8 +146,10 @@ struct AllNullableTypes { static func fromList(_ list: [Any?]) -> AllNullableTypes? { let aNullableBool: Bool? = nilOrValue(list[0]) - let aNullableInt: Int64? = isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) - let aNullableInt64: Int64? = isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) + let aNullableInt: Int64? = + isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) + let aNullableInt64: Int64? = + isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) let aNullableDouble: Double? = nilOrValue(list[3]) let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(list[4]) let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(list[5]) @@ -304,7 +308,8 @@ private class HostIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderWrit } class HostIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = HostIntegrationCoreApiCodec(readerWriter: HostIntegrationCoreApiCodecReaderWriter()) + static let shared = HostIntegrationCoreApiCodec( + readerWriter: HostIntegrationCoreApiCodecReaderWriter()) } /// The core interface that each host language plugin must implement in @@ -358,7 +363,9 @@ protocol HostIntegrationCoreApi { /// sending of nested objects. func createNestedObject(with nullableString: String?) throws -> AllClassesWrapper /// Returns passed in arguments of multiple types. - func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?) throws -> AllNullableTypes + func sendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String? + ) throws -> AllNullableTypes /// Returns passed in int. func echo(_ aNullableInt: Int64?) throws -> Int64? /// Returns passed in double. @@ -392,13 +399,16 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsync(_ aString: String, completion: @escaping (Result) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsync(_ aUint8List: FlutterStandardTypedData, completion: @escaping (Result) -> Void) + func echoAsync( + _ aUint8List: FlutterStandardTypedData, + completion: @escaping (Result) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsync(_ anObject: Any, completion: @escaping (Result) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsync(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsync(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func echoAsync( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) /// Returns the passed enum, to test asynchronous serialization and deserialization. func echoAsync(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) /// Responds with an error from an async function returning a value. @@ -410,7 +420,9 @@ protocol HostIntegrationCoreApi { /// Returns the passed object, to test async serialization and deserialization. func echoAsync(_ everything: AllTypes, completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoAsync(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) + func echoAsync( + _ everything: AllNullableTypes?, + completion: @escaping (Result) -> Void) /// Returns passed in int asynchronously. func echoAsyncNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) /// Returns passed in double asynchronously. @@ -420,37 +432,56 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsyncNullable(_ aString: String?, completion: @escaping (Result) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsyncNullable(_ aUint8List: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) + func echoAsyncNullable( + _ aUint8List: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsyncNullable(_ anObject: Any?, completion: @escaping (Result) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsyncNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsyncNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func echoAsyncNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) /// Returns the passed enum, to test asynchronous serialization and deserialization. func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) func callFlutterNoop(completion: @escaping (Result) -> Void) func callFlutterThrowError(completion: @escaping (Result) -> Void) func callFlutterThrowErrorFromVoid(completion: @escaping (Result) -> Void) - func callFlutterEcho(_ everything: AllTypes, completion: @escaping (Result) -> Void) - func callFlutterEcho(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) - func callFlutterSendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, completion: @escaping (Result) -> Void) + func callFlutterEcho( + _ everything: AllTypes, completion: @escaping (Result) -> Void) + func callFlutterEcho( + _ everything: AllNullableTypes?, + completion: @escaping (Result) -> Void) + func callFlutterSendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, + completion: @escaping (Result) -> Void) func callFlutterEcho(_ aBool: Bool, completion: @escaping (Result) -> Void) func callFlutterEcho(_ anInt: Int64, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aDouble: Double, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aString: String, completion: @escaping (Result) -> Void) - func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (Result) -> Void) + func callFlutterEcho( + _ aList: FlutterStandardTypedData, + completion: @escaping (Result) -> Void) func callFlutterEcho(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) - func callFlutterEcho(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func callFlutterEcho( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aString: String?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) - func callFlutterEchoNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) - func callFlutterNullableEcho(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ anInt: Int64?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aDouble: Double?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aString: String?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aList: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) + func callFlutterEchoNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func callFlutterNullableEcho( + _ anEnum: AnEnum?, completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -461,7 +492,9 @@ class HostIntegrationCoreApiSetup { static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostIntegrationCoreApi?) { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. - let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", binaryMessenger: binaryMessenger, codec: codec) + let noopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -475,7 +508,9 @@ class HostIntegrationCoreApiSetup { noopChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAllTypesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -491,7 +526,9 @@ class HostIntegrationCoreApiSetup { echoAllTypesChannel.setMessageHandler(nil) } /// Returns an error, to test error handling. - let throwErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", binaryMessenger: binaryMessenger, codec: codec) + let throwErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorChannel.setMessageHandler { _, reply in do { @@ -505,7 +542,9 @@ class HostIntegrationCoreApiSetup { throwErrorChannel.setMessageHandler(nil) } /// Returns an error from a void function, to test error handling. - let throwErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let throwErrorFromVoidChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorFromVoidChannel.setMessageHandler { _, reply in do { @@ -519,7 +558,9 @@ class HostIntegrationCoreApiSetup { throwErrorFromVoidChannel.setMessageHandler(nil) } /// Returns a Flutter error, to test error handling. - let throwFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", binaryMessenger: binaryMessenger, codec: codec) + let throwFlutterErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwFlutterErrorChannel.setMessageHandler { _, reply in do { @@ -533,7 +574,9 @@ class HostIntegrationCoreApiSetup { throwFlutterErrorChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec) + let echoIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -549,7 +592,9 @@ class HostIntegrationCoreApiSetup { echoIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -565,7 +610,9 @@ class HostIntegrationCoreApiSetup { echoDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec) + let echoBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -581,7 +628,9 @@ class HostIntegrationCoreApiSetup { echoBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec) + let echoStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -597,7 +646,9 @@ class HostIntegrationCoreApiSetup { echoStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoUint8ListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -613,7 +664,9 @@ class HostIntegrationCoreApiSetup { echoUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", binaryMessenger: binaryMessenger, codec: codec) + let echoObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -629,7 +682,9 @@ class HostIntegrationCoreApiSetup { echoObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec) + let echoListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -645,7 +700,9 @@ class HostIntegrationCoreApiSetup { echoListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec) + let echoMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -661,7 +718,9 @@ class HostIntegrationCoreApiSetup { echoMapChannel.setMessageHandler(nil) } /// Returns the passed map to test nested class serialization and deserialization. - let echoClassWrapperChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", binaryMessenger: binaryMessenger, codec: codec) + let echoClassWrapperChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoClassWrapperChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -677,7 +736,9 @@ class HostIntegrationCoreApiSetup { echoClassWrapperChannel.setMessageHandler(nil) } /// Returns the passed enum to test serialization and deserialization. - let echoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -693,7 +754,10 @@ class HostIntegrationCoreApiSetup { echoEnumChannel.setMessageHandler(nil) } /// Returns the default string. - let echoNamedDefaultStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", binaryMessenger: binaryMessenger, codec: codec) + let echoNamedDefaultStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedDefaultStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -709,7 +773,10 @@ class HostIntegrationCoreApiSetup { echoNamedDefaultStringChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalDefaultDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -725,7 +792,9 @@ class HostIntegrationCoreApiSetup { echoOptionalDefaultDoubleChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoRequiredIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", binaryMessenger: binaryMessenger, codec: codec) + let echoRequiredIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoRequiredIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -741,7 +810,10 @@ class HostIntegrationCoreApiSetup { echoRequiredIntChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -758,7 +830,10 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let extractNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let extractNestedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { extractNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -775,7 +850,10 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let createNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let createNestedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { createNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -791,15 +869,21 @@ class HostIntegrationCoreApiSetup { createNestedNullableStringChannel.setMessageHandler(nil) } /// Returns passed in arguments of multiple types. - let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { sendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[1]) + ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) do { - let result = try api.sendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) + let result = try api.sendMultipleNullableTypes( + aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -809,11 +893,15 @@ class HostIntegrationCoreApiSetup { sendMultipleNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echo(aNullableIntArg) reply(wrapResult(result)) @@ -825,7 +913,9 @@ class HostIntegrationCoreApiSetup { echoNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -841,7 +931,9 @@ class HostIntegrationCoreApiSetup { echoNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -857,7 +949,9 @@ class HostIntegrationCoreApiSetup { echoNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -873,7 +967,10 @@ class HostIntegrationCoreApiSetup { echoNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -889,7 +986,9 @@ class HostIntegrationCoreApiSetup { echoNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -905,7 +1004,9 @@ class HostIntegrationCoreApiSetup { echoNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -921,7 +1022,9 @@ class HostIntegrationCoreApiSetup { echoNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -936,7 +1039,9 @@ class HostIntegrationCoreApiSetup { } else { echoNullableMapChannel.setMessageHandler(nil) } - let echoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -952,11 +1057,16 @@ class HostIntegrationCoreApiSetup { echoNullableEnumChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoOptionalNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echoOptional(aNullableIntArg) reply(wrapResult(result)) @@ -968,7 +1078,10 @@ class HostIntegrationCoreApiSetup { echoOptionalNullableIntChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNamedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoNamedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -985,7 +1098,9 @@ class HostIntegrationCoreApiSetup { } /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. - let noopAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", binaryMessenger: binaryMessenger, codec: codec) + let noopAsyncChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopAsyncChannel.setMessageHandler { _, reply in api.noopAsync { result in @@ -1001,7 +1116,9 @@ class HostIntegrationCoreApiSetup { noopAsyncChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1019,7 +1136,9 @@ class HostIntegrationCoreApiSetup { echoAsyncIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1037,7 +1156,9 @@ class HostIntegrationCoreApiSetup { echoAsyncDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1055,7 +1176,9 @@ class HostIntegrationCoreApiSetup { echoAsyncBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1073,7 +1196,9 @@ class HostIntegrationCoreApiSetup { echoAsyncStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncUint8ListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1091,7 +1216,9 @@ class HostIntegrationCoreApiSetup { echoAsyncUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1109,7 +1236,9 @@ class HostIntegrationCoreApiSetup { echoAsyncObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1127,7 +1256,9 @@ class HostIntegrationCoreApiSetup { echoAsyncListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1145,7 +1276,9 @@ class HostIntegrationCoreApiSetup { echoAsyncMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1163,7 +1296,9 @@ class HostIntegrationCoreApiSetup { echoAsyncEnumChannel.setMessageHandler(nil) } /// Responds with an error from an async function returning a value. - let throwAsyncErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorChannel.setMessageHandler { _, reply in api.throwAsyncError { result in @@ -1179,7 +1314,10 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorChannel.setMessageHandler(nil) } /// Responds with an error from an async void function. - let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorFromVoidChannel.setMessageHandler { _, reply in api.throwAsyncErrorFromVoid { result in @@ -1195,7 +1333,10 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorFromVoidChannel.setMessageHandler(nil) } /// Responds with a Flutter error from an async function returning a value. - let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncFlutterErrorChannel.setMessageHandler { _, reply in api.throwAsyncFlutterError { result in @@ -1211,7 +1352,9 @@ class HostIntegrationCoreApiSetup { throwAsyncFlutterErrorChannel.setMessageHandler(nil) } /// Returns the passed object, to test async serialization and deserialization. - let echoAsyncAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncAllTypesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1229,7 +1372,10 @@ class HostIntegrationCoreApiSetup { echoAsyncAllTypesChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1247,11 +1393,16 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableAllNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.echoAsyncNullable(anIntArg) { result in switch result { case .success(let res): @@ -1265,7 +1416,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1283,7 +1437,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1301,7 +1458,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1319,7 +1479,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1337,7 +1500,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1355,7 +1521,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1373,7 +1542,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableMapChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1391,7 +1563,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1408,7 +1583,9 @@ class HostIntegrationCoreApiSetup { } else { echoAsyncNullableEnumChannel.setMessageHandler(nil) } - let callFlutterNoopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterNoopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterNoopChannel.setMessageHandler { _, reply in api.callFlutterNoop { result in @@ -1423,7 +1600,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterNoopChannel.setMessageHandler(nil) } - let callFlutterThrowErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorChannel.setMessageHandler { _, reply in api.callFlutterThrowError { result in @@ -1438,7 +1618,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterThrowErrorChannel.setMessageHandler(nil) } - let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorFromVoidChannel.setMessageHandler { _, reply in api.callFlutterThrowErrorFromVoid { result in @@ -1453,7 +1636,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterThrowErrorFromVoidChannel.setMessageHandler(nil) } - let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1470,7 +1656,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoAllTypesChannel.setMessageHandler(nil) } - let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1487,14 +1676,21 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoAllNullableTypesChannel.setMessageHandler(nil) } - let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterSendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[1]) + ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) - api.callFlutterSendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) { result in + api.callFlutterSendMultipleNullableTypes( + aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg + ) { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -1506,7 +1702,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterSendMultipleNullableTypesChannel.setMessageHandler(nil) } - let callFlutterEchoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1523,7 +1722,9 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoBoolChannel.setMessageHandler(nil) } - let callFlutterEchoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1540,7 +1741,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoIntChannel.setMessageHandler(nil) } - let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1557,7 +1761,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1574,7 +1781,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoStringChannel.setMessageHandler(nil) } - let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1591,7 +1801,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1608,7 +1821,9 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoListChannel.setMessageHandler(nil) } - let callFlutterEchoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1625,7 +1840,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoMapChannel.setMessageHandler(nil) } - let callFlutterEchoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1642,7 +1860,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoEnumChannel.setMessageHandler(nil) } - let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1659,11 +1880,16 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableBoolChannel.setMessageHandler(nil) } - let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.callFlutterEchoNullable(anIntArg) { result in switch result { case .success(let res): @@ -1676,7 +1902,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableIntChannel.setMessageHandler(nil) } - let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1693,7 +1922,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1710,7 +1942,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableStringChannel.setMessageHandler(nil) } - let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1727,7 +1962,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1744,7 +1982,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1761,7 +2002,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableMapChannel.setMessageHandler(nil) } - let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1828,7 +2072,8 @@ private class FlutterIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderW } class FlutterIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = FlutterIntegrationCoreApiCodec(readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) + static let shared = FlutterIntegrationCoreApiCodec( + readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) } /// The core interface that the Dart platform_test code implements for host @@ -1844,13 +2089,19 @@ protocol FlutterIntegrationCoreApiProtocol { /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echo(_ everythingArg: AllTypes, completion: @escaping (Result) -> Void) + func echo( + _ everythingArg: AllTypes, completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result) -> Void) + func echoNullable( + _ everythingArg: AllNullableTypes?, + completion: @escaping (Result) -> Void) /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, aString aNullableStringArg: String?, completion: @escaping (Result) -> Void) + func sendMultipleNullableTypes( + aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, + aString aNullableStringArg: String?, + completion: @escaping (Result) -> Void) /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result) -> Void) /// Returns the passed int, to test serialization and deserialization. @@ -1860,29 +2111,42 @@ protocol FlutterIntegrationCoreApiProtocol { /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result) -> Void) + func echo( + _ aListArg: FlutterStandardTypedData, + completion: @escaping (Result) -> Void) /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) + func echo( + _ aMapArg: [String?: Any?], + completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, completion: @escaping (Result) -> Void) /// Returns the passed boolean, to test serialization and deserialization. func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) /// Returns the passed int, to test serialization and deserialization. - func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result) -> Void) + func echoNullable( + _ anIntArg: Int64?, completion: @escaping (Result) -> Void) /// Returns the passed double, to test serialization and deserialization. - func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result) -> Void) + func echoNullable( + _ aDoubleArg: Double?, completion: @escaping (Result) -> Void) /// Returns the passed string, to test serialization and deserialization. - func echoNullable(_ aStringArg: String?, completion: @escaping (Result) -> Void) + func echoNullable( + _ aStringArg: String?, completion: @escaping (Result) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) + func echoNullable( + _ aListArg: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void) /// Returns the passed list, to test serialization and deserialization. - func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) + func echoNullable( + _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) + func echoNullable( + _ aMapArg: [String?: Any?]?, + completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. - func echoNullable(_ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) + func echoNullable( + _ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result) -> Void) @@ -1900,8 +2164,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. func noop(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1919,8 +2185,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async function returning a value. func throwError(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1939,8 +2207,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1957,9 +2227,13 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed object, to test serialization and deserialization. - func echo(_ everythingArg: AllTypes, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ everythingArg: AllTypes, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1971,7 +2245,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllTypes completion(.success(result)) @@ -1979,9 +2257,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed object, to test serialization and deserialization. - func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ everythingArg: AllNullableTypes?, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2001,10 +2284,17 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, aString aNullableStringArg: String?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in + func sendMultipleNullableTypes( + aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, + aString aNullableStringArg: String?, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -2015,7 +2305,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllNullableTypes completion(.success(result)) @@ -2024,8 +2318,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2037,7 +2333,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Bool completion(.success(result)) @@ -2046,8 +2346,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed int, to test serialization and deserialization. func echo(_ anIntArg: Int64, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2059,17 +2361,24 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { - let result = listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) + let result = + listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. func echo(_ aDoubleArg: Double, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2081,7 +2390,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Double completion(.success(result)) @@ -2090,8 +2403,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2103,7 +2418,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2111,9 +2430,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ aListArg: FlutterStandardTypedData, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2125,7 +2449,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! FlutterStandardTypedData completion(.success(result)) @@ -2134,8 +2462,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2147,7 +2477,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [Any?] completion(.success(result)) @@ -2155,9 +2489,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ aMapArg: [String?: Any?], + completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2169,7 +2508,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [String?: Any?] completion(.success(result)) @@ -2178,8 +2521,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2191,7 +2536,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) @@ -2199,9 +2548,12 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) + { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2219,9 +2571,13 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed int, to test serialization and deserialization. - func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ anIntArg: Int64?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2233,15 +2589,23 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: Int64? = isNullish(listResponse[0]) ? nil : (listResponse[0] is Int64? ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) + let result: Int64? = + isNullish(listResponse[0]) + ? nil + : (listResponse[0] is Int64? + ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. - func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aDoubleArg: Double?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2259,9 +2623,13 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed string, to test serialization and deserialization. - func echoNullable(_ aStringArg: String?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aStringArg: String?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2279,9 +2647,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aListArg: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2299,9 +2672,13 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed list, to test serialization and deserialization. - func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2319,9 +2696,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aMapArg: [String?: Any?]?, + completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2339,9 +2721,13 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed enum to test serialization and deserialization. - func echoNullable(_ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg?.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2353,7 +2739,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: AnEnum? = isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! + let result: AnEnum? = + isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) } } @@ -2361,8 +2748,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2379,9 +2768,12 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed in generic Object asynchronously. - func echoAsync(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoAsync(_ aStringArg: String, completion: @escaping (Result) -> Void) + { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2393,7 +2785,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2413,7 +2809,9 @@ class HostTrivialApiSetup { /// The codec used by HostTrivialApi. /// Sets up an instance of `HostTrivialApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostTrivialApi?) { - let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", binaryMessenger: binaryMessenger) + let noopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", + binaryMessenger: binaryMessenger) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -2441,7 +2839,9 @@ class HostSmallApiSetup { /// The codec used by HostSmallApi. /// Sets up an instance of `HostSmallApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostSmallApi?) { - let echoChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", binaryMessenger: binaryMessenger) + let echoChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", + binaryMessenger: binaryMessenger) if let api = api { echoChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2458,7 +2858,9 @@ class HostSmallApiSetup { } else { echoChannel.setMessageHandler(nil) } - let voidVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", binaryMessenger: binaryMessenger) + let voidVoidChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", + binaryMessenger: binaryMessenger) if let api = api { voidVoidChannel.setMessageHandler { _, reply in api.voidVoid { result in @@ -2515,7 +2917,8 @@ class FlutterSmallApiCodec: FlutterStandardMessageCodec { /// /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol FlutterSmallApiProtocol { - func echo(_ msgArg: TestMessage, completion: @escaping (Result) -> Void) + func echo( + _ msgArg: TestMessage, completion: @escaping (Result) -> Void) func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) } class FlutterSmallApi: FlutterSmallApiProtocol { @@ -2526,9 +2929,13 @@ class FlutterSmallApi: FlutterSmallApiProtocol { var codec: FlutterStandardMessageCodec { return FlutterSmallApiCodec.shared } - func echo(_ msgArg: TestMessage, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ msgArg: TestMessage, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([msgArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2540,7 +2947,11 @@ class FlutterSmallApi: FlutterSmallApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! TestMessage completion(.success(result)) @@ -2548,8 +2959,10 @@ class FlutterSmallApi: FlutterSmallApiProtocol { } } func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2561,7 +2974,11 @@ class FlutterSmallApi: FlutterSmallApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift index 4dd101c0ccc..14bcb9a4113 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift @@ -35,7 +35,9 @@ private func wrapError(_ error: Any) -> [Any?] { } private func createConnectionError(withChannelName channelName: String) -> FlutterError { - return FlutterError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") + return FlutterError( + code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", + details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -144,8 +146,10 @@ struct AllNullableTypes { static func fromList(_ list: [Any?]) -> AllNullableTypes? { let aNullableBool: Bool? = nilOrValue(list[0]) - let aNullableInt: Int64? = isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) - let aNullableInt64: Int64? = isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) + let aNullableInt: Int64? = + isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) + let aNullableInt64: Int64? = + isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) let aNullableDouble: Double? = nilOrValue(list[3]) let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(list[4]) let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(list[5]) @@ -304,7 +308,8 @@ private class HostIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderWrit } class HostIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = HostIntegrationCoreApiCodec(readerWriter: HostIntegrationCoreApiCodecReaderWriter()) + static let shared = HostIntegrationCoreApiCodec( + readerWriter: HostIntegrationCoreApiCodecReaderWriter()) } /// The core interface that each host language plugin must implement in @@ -358,7 +363,9 @@ protocol HostIntegrationCoreApi { /// sending of nested objects. func createNestedObject(with nullableString: String?) throws -> AllClassesWrapper /// Returns passed in arguments of multiple types. - func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?) throws -> AllNullableTypes + func sendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String? + ) throws -> AllNullableTypes /// Returns passed in int. func echo(_ aNullableInt: Int64?) throws -> Int64? /// Returns passed in double. @@ -392,13 +399,16 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsync(_ aString: String, completion: @escaping (Result) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsync(_ aUint8List: FlutterStandardTypedData, completion: @escaping (Result) -> Void) + func echoAsync( + _ aUint8List: FlutterStandardTypedData, + completion: @escaping (Result) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsync(_ anObject: Any, completion: @escaping (Result) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsync(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsync(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func echoAsync( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) /// Returns the passed enum, to test asynchronous serialization and deserialization. func echoAsync(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) /// Responds with an error from an async function returning a value. @@ -410,7 +420,9 @@ protocol HostIntegrationCoreApi { /// Returns the passed object, to test async serialization and deserialization. func echoAsync(_ everything: AllTypes, completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoAsync(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) + func echoAsync( + _ everything: AllNullableTypes?, + completion: @escaping (Result) -> Void) /// Returns passed in int asynchronously. func echoAsyncNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) /// Returns passed in double asynchronously. @@ -420,37 +432,56 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsyncNullable(_ aString: String?, completion: @escaping (Result) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsyncNullable(_ aUint8List: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) + func echoAsyncNullable( + _ aUint8List: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsyncNullable(_ anObject: Any?, completion: @escaping (Result) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsyncNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsyncNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func echoAsyncNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) /// Returns the passed enum, to test asynchronous serialization and deserialization. func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) func callFlutterNoop(completion: @escaping (Result) -> Void) func callFlutterThrowError(completion: @escaping (Result) -> Void) func callFlutterThrowErrorFromVoid(completion: @escaping (Result) -> Void) - func callFlutterEcho(_ everything: AllTypes, completion: @escaping (Result) -> Void) - func callFlutterEcho(_ everything: AllNullableTypes?, completion: @escaping (Result) -> Void) - func callFlutterSendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, completion: @escaping (Result) -> Void) + func callFlutterEcho( + _ everything: AllTypes, completion: @escaping (Result) -> Void) + func callFlutterEcho( + _ everything: AllNullableTypes?, + completion: @escaping (Result) -> Void) + func callFlutterSendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, + completion: @escaping (Result) -> Void) func callFlutterEcho(_ aBool: Bool, completion: @escaping (Result) -> Void) func callFlutterEcho(_ anInt: Int64, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aDouble: Double, completion: @escaping (Result) -> Void) func callFlutterEcho(_ aString: String, completion: @escaping (Result) -> Void) - func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (Result) -> Void) + func callFlutterEcho( + _ aList: FlutterStandardTypedData, + completion: @escaping (Result) -> Void) func callFlutterEcho(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) - func callFlutterEcho(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func callFlutterEcho( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aString: String?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) - func callFlutterEchoNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) - func callFlutterNullableEcho(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ anInt: Int64?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aDouble: Double?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aString: String?, completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aList: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void) + func callFlutterEchoNullable( + _ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) + func callFlutterEchoNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func callFlutterNullableEcho( + _ anEnum: AnEnum?, completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -461,7 +492,9 @@ class HostIntegrationCoreApiSetup { static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostIntegrationCoreApi?) { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. - let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", binaryMessenger: binaryMessenger, codec: codec) + let noopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -475,7 +508,9 @@ class HostIntegrationCoreApiSetup { noopChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAllTypesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -491,7 +526,9 @@ class HostIntegrationCoreApiSetup { echoAllTypesChannel.setMessageHandler(nil) } /// Returns an error, to test error handling. - let throwErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", binaryMessenger: binaryMessenger, codec: codec) + let throwErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorChannel.setMessageHandler { _, reply in do { @@ -505,7 +542,9 @@ class HostIntegrationCoreApiSetup { throwErrorChannel.setMessageHandler(nil) } /// Returns an error from a void function, to test error handling. - let throwErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let throwErrorFromVoidChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorFromVoidChannel.setMessageHandler { _, reply in do { @@ -519,7 +558,9 @@ class HostIntegrationCoreApiSetup { throwErrorFromVoidChannel.setMessageHandler(nil) } /// Returns a Flutter error, to test error handling. - let throwFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", binaryMessenger: binaryMessenger, codec: codec) + let throwFlutterErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwFlutterErrorChannel.setMessageHandler { _, reply in do { @@ -533,7 +574,9 @@ class HostIntegrationCoreApiSetup { throwFlutterErrorChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec) + let echoIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -549,7 +592,9 @@ class HostIntegrationCoreApiSetup { echoIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -565,7 +610,9 @@ class HostIntegrationCoreApiSetup { echoDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec) + let echoBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -581,7 +628,9 @@ class HostIntegrationCoreApiSetup { echoBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec) + let echoStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -597,7 +646,9 @@ class HostIntegrationCoreApiSetup { echoStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoUint8ListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -613,7 +664,9 @@ class HostIntegrationCoreApiSetup { echoUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", binaryMessenger: binaryMessenger, codec: codec) + let echoObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -629,7 +682,9 @@ class HostIntegrationCoreApiSetup { echoObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec) + let echoListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -645,7 +700,9 @@ class HostIntegrationCoreApiSetup { echoListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec) + let echoMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -661,7 +718,9 @@ class HostIntegrationCoreApiSetup { echoMapChannel.setMessageHandler(nil) } /// Returns the passed map to test nested class serialization and deserialization. - let echoClassWrapperChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", binaryMessenger: binaryMessenger, codec: codec) + let echoClassWrapperChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoClassWrapperChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -677,7 +736,9 @@ class HostIntegrationCoreApiSetup { echoClassWrapperChannel.setMessageHandler(nil) } /// Returns the passed enum to test serialization and deserialization. - let echoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -693,7 +754,10 @@ class HostIntegrationCoreApiSetup { echoEnumChannel.setMessageHandler(nil) } /// Returns the default string. - let echoNamedDefaultStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", binaryMessenger: binaryMessenger, codec: codec) + let echoNamedDefaultStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedDefaultStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -709,7 +773,10 @@ class HostIntegrationCoreApiSetup { echoNamedDefaultStringChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalDefaultDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -725,7 +792,9 @@ class HostIntegrationCoreApiSetup { echoOptionalDefaultDoubleChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoRequiredIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", binaryMessenger: binaryMessenger, codec: codec) + let echoRequiredIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoRequiredIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -741,7 +810,10 @@ class HostIntegrationCoreApiSetup { echoRequiredIntChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -758,7 +830,10 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let extractNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let extractNestedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { extractNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -775,7 +850,10 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let createNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let createNestedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { createNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -791,15 +869,21 @@ class HostIntegrationCoreApiSetup { createNestedNullableStringChannel.setMessageHandler(nil) } /// Returns passed in arguments of multiple types. - let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { sendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[1]) + ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) do { - let result = try api.sendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) + let result = try api.sendMultipleNullableTypes( + aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -809,11 +893,15 @@ class HostIntegrationCoreApiSetup { sendMultipleNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echo(aNullableIntArg) reply(wrapResult(result)) @@ -825,7 +913,9 @@ class HostIntegrationCoreApiSetup { echoNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -841,7 +931,9 @@ class HostIntegrationCoreApiSetup { echoNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -857,7 +949,9 @@ class HostIntegrationCoreApiSetup { echoNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -873,7 +967,10 @@ class HostIntegrationCoreApiSetup { echoNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -889,7 +986,9 @@ class HostIntegrationCoreApiSetup { echoNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -905,7 +1004,9 @@ class HostIntegrationCoreApiSetup { echoNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -921,7 +1022,9 @@ class HostIntegrationCoreApiSetup { echoNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -936,7 +1039,9 @@ class HostIntegrationCoreApiSetup { } else { echoNullableMapChannel.setMessageHandler(nil) } - let echoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -952,11 +1057,16 @@ class HostIntegrationCoreApiSetup { echoNullableEnumChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoOptionalNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echoOptional(aNullableIntArg) reply(wrapResult(result)) @@ -968,7 +1078,10 @@ class HostIntegrationCoreApiSetup { echoOptionalNullableIntChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNamedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoNamedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -985,7 +1098,9 @@ class HostIntegrationCoreApiSetup { } /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. - let noopAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", binaryMessenger: binaryMessenger, codec: codec) + let noopAsyncChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopAsyncChannel.setMessageHandler { _, reply in api.noopAsync { result in @@ -1001,7 +1116,9 @@ class HostIntegrationCoreApiSetup { noopAsyncChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1019,7 +1136,9 @@ class HostIntegrationCoreApiSetup { echoAsyncIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1037,7 +1156,9 @@ class HostIntegrationCoreApiSetup { echoAsyncDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1055,7 +1176,9 @@ class HostIntegrationCoreApiSetup { echoAsyncBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1073,7 +1196,9 @@ class HostIntegrationCoreApiSetup { echoAsyncStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncUint8ListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1091,7 +1216,9 @@ class HostIntegrationCoreApiSetup { echoAsyncUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1109,7 +1236,9 @@ class HostIntegrationCoreApiSetup { echoAsyncObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1127,7 +1256,9 @@ class HostIntegrationCoreApiSetup { echoAsyncListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1145,7 +1276,9 @@ class HostIntegrationCoreApiSetup { echoAsyncMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1163,7 +1296,9 @@ class HostIntegrationCoreApiSetup { echoAsyncEnumChannel.setMessageHandler(nil) } /// Responds with an error from an async function returning a value. - let throwAsyncErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorChannel.setMessageHandler { _, reply in api.throwAsyncError { result in @@ -1179,7 +1314,10 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorChannel.setMessageHandler(nil) } /// Responds with an error from an async void function. - let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorFromVoidChannel.setMessageHandler { _, reply in api.throwAsyncErrorFromVoid { result in @@ -1195,7 +1333,10 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorFromVoidChannel.setMessageHandler(nil) } /// Responds with a Flutter error from an async function returning a value. - let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncFlutterErrorChannel.setMessageHandler { _, reply in api.throwAsyncFlutterError { result in @@ -1211,7 +1352,9 @@ class HostIntegrationCoreApiSetup { throwAsyncFlutterErrorChannel.setMessageHandler(nil) } /// Returns the passed object, to test async serialization and deserialization. - let echoAsyncAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncAllTypesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1229,7 +1372,10 @@ class HostIntegrationCoreApiSetup { echoAsyncAllTypesChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1247,11 +1393,16 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableAllNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.echoAsyncNullable(anIntArg) { result in switch result { case .success(let res): @@ -1265,7 +1416,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1283,7 +1437,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1301,7 +1458,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1319,7 +1479,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1337,7 +1500,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1355,7 +1521,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1373,7 +1542,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableMapChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1391,7 +1563,10 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1408,7 +1583,9 @@ class HostIntegrationCoreApiSetup { } else { echoAsyncNullableEnumChannel.setMessageHandler(nil) } - let callFlutterNoopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterNoopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterNoopChannel.setMessageHandler { _, reply in api.callFlutterNoop { result in @@ -1423,7 +1600,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterNoopChannel.setMessageHandler(nil) } - let callFlutterThrowErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorChannel.setMessageHandler { _, reply in api.callFlutterThrowError { result in @@ -1438,7 +1618,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterThrowErrorChannel.setMessageHandler(nil) } - let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorFromVoidChannel.setMessageHandler { _, reply in api.callFlutterThrowErrorFromVoid { result in @@ -1453,7 +1636,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterThrowErrorFromVoidChannel.setMessageHandler(nil) } - let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1470,7 +1656,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoAllTypesChannel.setMessageHandler(nil) } - let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1487,14 +1676,21 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoAllNullableTypesChannel.setMessageHandler(nil) } - let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterSendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[1]) + ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) - api.callFlutterSendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) { result in + api.callFlutterSendMultipleNullableTypes( + aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg + ) { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -1506,7 +1702,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterSendMultipleNullableTypesChannel.setMessageHandler(nil) } - let callFlutterEchoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1523,7 +1722,9 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoBoolChannel.setMessageHandler(nil) } - let callFlutterEchoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1540,7 +1741,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoIntChannel.setMessageHandler(nil) } - let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1557,7 +1761,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1574,7 +1781,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoStringChannel.setMessageHandler(nil) } - let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1591,7 +1801,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1608,7 +1821,9 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoListChannel.setMessageHandler(nil) } - let callFlutterEchoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1625,7 +1840,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoMapChannel.setMessageHandler(nil) } - let callFlutterEchoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1642,7 +1860,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoEnumChannel.setMessageHandler(nil) } - let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1659,11 +1880,16 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableBoolChannel.setMessageHandler(nil) } - let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.callFlutterEchoNullable(anIntArg) { result in switch result { case .success(let res): @@ -1676,7 +1902,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableIntChannel.setMessageHandler(nil) } - let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1693,7 +1922,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1710,7 +1942,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableStringChannel.setMessageHandler(nil) } - let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1727,7 +1962,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1744,7 +1982,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1761,7 +2002,10 @@ class HostIntegrationCoreApiSetup { } else { callFlutterEchoNullableMapChannel.setMessageHandler(nil) } - let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1828,7 +2072,8 @@ private class FlutterIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderW } class FlutterIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = FlutterIntegrationCoreApiCodec(readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) + static let shared = FlutterIntegrationCoreApiCodec( + readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) } /// The core interface that the Dart platform_test code implements for host @@ -1844,13 +2089,19 @@ protocol FlutterIntegrationCoreApiProtocol { /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echo(_ everythingArg: AllTypes, completion: @escaping (Result) -> Void) + func echo( + _ everythingArg: AllTypes, completion: @escaping (Result) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result) -> Void) + func echoNullable( + _ everythingArg: AllNullableTypes?, + completion: @escaping (Result) -> Void) /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, aString aNullableStringArg: String?, completion: @escaping (Result) -> Void) + func sendMultipleNullableTypes( + aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, + aString aNullableStringArg: String?, + completion: @escaping (Result) -> Void) /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result) -> Void) /// Returns the passed int, to test serialization and deserialization. @@ -1860,29 +2111,42 @@ protocol FlutterIntegrationCoreApiProtocol { /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result) -> Void) + func echo( + _ aListArg: FlutterStandardTypedData, + completion: @escaping (Result) -> Void) /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) + func echo( + _ aMapArg: [String?: Any?], + completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, completion: @escaping (Result) -> Void) /// Returns the passed boolean, to test serialization and deserialization. func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) /// Returns the passed int, to test serialization and deserialization. - func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result) -> Void) + func echoNullable( + _ anIntArg: Int64?, completion: @escaping (Result) -> Void) /// Returns the passed double, to test serialization and deserialization. - func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result) -> Void) + func echoNullable( + _ aDoubleArg: Double?, completion: @escaping (Result) -> Void) /// Returns the passed string, to test serialization and deserialization. - func echoNullable(_ aStringArg: String?, completion: @escaping (Result) -> Void) + func echoNullable( + _ aStringArg: String?, completion: @escaping (Result) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) + func echoNullable( + _ aListArg: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void) /// Returns the passed list, to test serialization and deserialization. - func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) + func echoNullable( + _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) + func echoNullable( + _ aMapArg: [String?: Any?]?, + completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. - func echoNullable(_ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) + func echoNullable( + _ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result) -> Void) @@ -1900,8 +2164,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. func noop(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1919,8 +2185,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async function returning a value. func throwError(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1939,8 +2207,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1957,9 +2227,13 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed object, to test serialization and deserialization. - func echo(_ everythingArg: AllTypes, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ everythingArg: AllTypes, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -1971,7 +2245,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllTypes completion(.success(result)) @@ -1979,9 +2257,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed object, to test serialization and deserialization. - func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ everythingArg: AllNullableTypes?, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2001,10 +2284,17 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, aString aNullableStringArg: String?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in + func sendMultipleNullableTypes( + aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, + aString aNullableStringArg: String?, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -2015,7 +2305,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllNullableTypes completion(.success(result)) @@ -2024,8 +2318,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2037,7 +2333,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Bool completion(.success(result)) @@ -2046,8 +2346,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed int, to test serialization and deserialization. func echo(_ anIntArg: Int64, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2059,17 +2361,24 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { - let result = listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) + let result = + listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. func echo(_ aDoubleArg: Double, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2081,7 +2390,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Double completion(.success(result)) @@ -2090,8 +2403,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2103,7 +2418,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2111,9 +2430,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ aListArg: FlutterStandardTypedData, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2125,7 +2449,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! FlutterStandardTypedData completion(.success(result)) @@ -2134,8 +2462,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2147,7 +2477,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [Any?] completion(.success(result)) @@ -2155,9 +2489,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ aMapArg: [String?: Any?], + completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2169,7 +2508,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [String?: Any?] completion(.success(result)) @@ -2178,8 +2521,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2191,7 +2536,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) @@ -2199,9 +2548,12 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result) -> Void) + { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2219,9 +2571,13 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed int, to test serialization and deserialization. - func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ anIntArg: Int64?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2233,15 +2589,23 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: Int64? = isNullish(listResponse[0]) ? nil : (listResponse[0] is Int64? ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) + let result: Int64? = + isNullish(listResponse[0]) + ? nil + : (listResponse[0] is Int64? + ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. - func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aDoubleArg: Double?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2259,9 +2623,13 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed string, to test serialization and deserialization. - func echoNullable(_ aStringArg: String?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aStringArg: String?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2279,9 +2647,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aListArg: FlutterStandardTypedData?, + completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2299,9 +2672,13 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed list, to test serialization and deserialization. - func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2319,9 +2696,14 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aMapArg: [String?: Any?]?, + completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2339,9 +2721,13 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed enum to test serialization and deserialization. - func echoNullable(_ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg?.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2353,7 +2739,8 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: AnEnum? = isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! + let result: AnEnum? = + isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) } } @@ -2361,8 +2748,10 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2379,9 +2768,12 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed in generic Object asynchronously. - func echoAsync(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoAsync(_ aStringArg: String, completion: @escaping (Result) -> Void) + { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2393,7 +2785,11 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2413,7 +2809,9 @@ class HostTrivialApiSetup { /// The codec used by HostTrivialApi. /// Sets up an instance of `HostTrivialApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostTrivialApi?) { - let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", binaryMessenger: binaryMessenger) + let noopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", + binaryMessenger: binaryMessenger) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -2441,7 +2839,9 @@ class HostSmallApiSetup { /// The codec used by HostSmallApi. /// Sets up an instance of `HostSmallApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostSmallApi?) { - let echoChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", binaryMessenger: binaryMessenger) + let echoChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", + binaryMessenger: binaryMessenger) if let api = api { echoChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2458,7 +2858,9 @@ class HostSmallApiSetup { } else { echoChannel.setMessageHandler(nil) } - let voidVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", binaryMessenger: binaryMessenger) + let voidVoidChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", + binaryMessenger: binaryMessenger) if let api = api { voidVoidChannel.setMessageHandler { _, reply in api.voidVoid { result in @@ -2515,7 +2917,8 @@ class FlutterSmallApiCodec: FlutterStandardMessageCodec { /// /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol FlutterSmallApiProtocol { - func echo(_ msgArg: TestMessage, completion: @escaping (Result) -> Void) + func echo( + _ msgArg: TestMessage, completion: @escaping (Result) -> Void) func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) } class FlutterSmallApi: FlutterSmallApiProtocol { @@ -2526,9 +2929,13 @@ class FlutterSmallApi: FlutterSmallApiProtocol { var codec: FlutterStandardMessageCodec { return FlutterSmallApiCodec.shared } - func echo(_ msgArg: TestMessage, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ msgArg: TestMessage, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([msgArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2540,7 +2947,11 @@ class FlutterSmallApi: FlutterSmallApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! TestMessage completion(.success(result)) @@ -2548,8 +2959,10 @@ class FlutterSmallApi: FlutterSmallApiProtocol { } } func echo(_ aStringArg: String, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -2561,7 +2974,11 @@ class FlutterSmallApi: FlutterSmallApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(FlutterError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) diff --git a/packages/pigeon/tool/run_tests.dart b/packages/pigeon/tool/run_tests.dart index 6d663924610..ffcbe78887b 100644 --- a/packages/pigeon/tool/run_tests.dart +++ b/packages/pigeon/tool/run_tests.dart @@ -13,6 +13,7 @@ library; import 'dart:io'; +import 'package:collection/collection.dart'; import 'package:path/path.dart' as p; import 'shared/generation.dart'; @@ -35,62 +36,55 @@ void _validateTestCoverage(List> shards) { } Future _validateGeneratedTestFiles() async { - final String baseDir = p.dirname(p.dirname(Platform.script.toFilePath())); - final String repositoryRoot = p.dirname(p.dirname(baseDir)); - final String relativePigeonPath = p.relative(baseDir, from: repositoryRoot); - - print('Validating generated files:'); - print(' Generating test output...'); - final int generateExitCode = await generateTestPigeons(baseDir: baseDir); - if (generateExitCode != 0) { - print('Generation failed; see above for errors.'); - exit(generateExitCode); - } - - print(' Formatting output...'); - final int formatExitCode = - await formatAllFiles(repositoryRoot: repositoryRoot); - if (formatExitCode != 0) { - print('Formatting failed; see above for errors.'); - exit(formatExitCode); - } + await _validateGeneratedFiles( + (String baseDir) => generateTestPigeons(baseDir: baseDir), + generationMessage: 'Generating test output', + incorrectFilesMessage: + 'The following files are not updated, or not formatted correctly:', + ); +} - print(' Checking for changes...'); - final List modifiedFiles = await _modifiedFiles( - repositoryRoot: repositoryRoot, relativePigeonPath: relativePigeonPath); +Future _validateGeneratedExampleFiles() async { + await _validateGeneratedFiles( + (String _) => generateExamplePigeons(), + generationMessage: 'Generating example output', + incorrectFilesMessage: + 'Either messages.dart and messages_test.dart have non-matching definitions or\n' + 'the following files are not updated, or not formatted correctly:', + ); +} - if (modifiedFiles.isEmpty) { +Future _validateGeneratedFiles( + Future Function(String baseDirectory) generator, { + required String generationMessage, + required String incorrectFilesMessage, +}) async { + // Generated file validation is split by platform, both to avoid duplication + // of work, and to avoid issues if different CI configurations have different + // setups (e.g., different clang-format versions or no clang-format at all). + final Set languagesToValidate; + if (Platform.isLinux) { + languagesToValidate = { + GeneratorLanguage.cpp, + GeneratorLanguage.dart, + GeneratorLanguage.java, + GeneratorLanguage.kotlin, + GeneratorLanguage.objc, + }; + } else if (Platform.isMacOS) { + languagesToValidate = { + GeneratorLanguage.swift, + }; + } else { return; } - print('The following files are not updated, or not formatted correctly:'); - modifiedFiles.map((String line) => ' $line').forEach(print); - - print('\nTo fix run "dart run tool/generate.dart --format" from the pigeon/ ' - 'directory, or apply the diff with the command below.\n'); - - final ProcessResult diffResult = await Process.run( - 'git', - ['diff', relativePigeonPath], - workingDirectory: repositoryRoot, - ); - if (diffResult.exitCode != 0) { - print('Unable to determine diff.'); - exit(1); - } - print('patch -p1 < _validateGeneratedExampleFiles() async { final String baseDir = p.dirname(p.dirname(Platform.script.toFilePath())); final String repositoryRoot = p.dirname(p.dirname(baseDir)); final String relativePigeonPath = p.relative(baseDir, from: repositoryRoot); print('Validating generated files:'); - print(' Generating example output...'); + print(' $generationMessage...'); final int generateExitCode = await generateExamplePigeons(); @@ -100,8 +94,8 @@ Future _validateGeneratedExampleFiles() async { } print(' Formatting output...'); - final int formatExitCode = - await formatAllFiles(repositoryRoot: repositoryRoot); + final int formatExitCode = await formatAllFiles( + repositoryRoot: repositoryRoot, languages: languagesToValidate); if (formatExitCode != 0) { print('Formatting failed; see above for errors.'); exit(formatExitCode); @@ -110,22 +104,26 @@ Future _validateGeneratedExampleFiles() async { print(' Checking for changes...'); final List modifiedFiles = await _modifiedFiles( repositoryRoot: repositoryRoot, relativePigeonPath: relativePigeonPath); - - if (modifiedFiles.isEmpty) { + final Set extensions = languagesToValidate + .map((GeneratorLanguage lang) => _extensionsForLanguage(lang)) + .flattened + .toSet(); + final Iterable filteredFiles = modifiedFiles.where((String path) => + extensions.contains(p.extension(path).replaceFirst('.', ''))); + + if (filteredFiles.isEmpty) { return; } - print( - 'Either messages.dart and messages_test.dart have non-matching definitions or'); - print('the following files are not updated, or not formatted correctly:'); - modifiedFiles.map((String line) => ' $line').forEach(print); + print(incorrectFilesMessage); + filteredFiles.map((String line) => ' $line').forEach(print); print('\nTo fix run "dart run tool/generate.dart --format" from the pigeon/ ' 'directory, or apply the diff with the command below.\n'); final ProcessResult diffResult = await Process.run( 'git', - ['diff', relativePigeonPath], + ['diff', ...filteredFiles], workingDirectory: repositoryRoot, ); if (diffResult.exitCode != 0) { @@ -138,6 +136,17 @@ Future _validateGeneratedExampleFiles() async { exit(1); } +Set _extensionsForLanguage(GeneratorLanguage language) { + return switch (language) { + GeneratorLanguage.cpp => {'cc', 'cpp', 'h'}, + GeneratorLanguage.dart => {'dart'}, + GeneratorLanguage.java => {'java'}, + GeneratorLanguage.kotlin => {'kt'}, + GeneratorLanguage.swift => {'swift'}, + GeneratorLanguage.objc => {'h', 'm', 'mm'}, + }; +} + Future> _modifiedFiles( {required String repositoryRoot, required String relativePigeonPath}) async { @@ -204,20 +213,13 @@ Future main(List args) async { ], ]); - // Ensure that all generated files are up to date. This is run only on Linux - // both to avoid duplication of work, and to avoid issues if different CI - // configurations have different setups (e.g., different clang-format versions - // or no clang-format at all). - if (Platform.isLinux) { - // Only run on master, since Dart format can change between versions. - // TODO(stuartmorgan): Make a more generic way to run this check only on - // master; this currently won't work for anything but Cirrus. - if (Platform.environment['CHANNEL'] == 'stable') { - print('Skipping generated file validation on stable.'); - } else { - await _validateGeneratedTestFiles(); - await _validateGeneratedExampleFiles(); - } + // Ensure that all generated files are up to date. + // Only run on master, since Dart format can change between versions. + if (Platform.environment['CHANNEL'] == 'stable') { + print('Skipping generated file validation on stable.'); + } else { + await _validateGeneratedTestFiles(); + await _validateGeneratedExampleFiles(); } final List testsToRun; diff --git a/packages/pigeon/tool/shared/generation.dart b/packages/pigeon/tool/shared/generation.dart index 03952ddbcfd..9915e26aa57 100644 --- a/packages/pigeon/tool/shared/generation.dart +++ b/packages/pigeon/tool/shared/generation.dart @@ -10,8 +10,9 @@ import 'package:pigeon/pigeon.dart'; import 'process_utils.dart'; -enum GeneratorLanguages { +enum GeneratorLanguage { cpp, + dart, java, kotlin, objc, @@ -20,8 +21,8 @@ enum GeneratorLanguages { // A map of pigeons/ files to the languages that they can't yet be generated // for due to limitations of that generator. -const Map> _unsupportedFiles = - >{}; +const Map> _unsupportedFiles = + >{}; String _snakeToPascalCase(String snake) { final List parts = snake.split('_'); @@ -77,28 +78,28 @@ Future generateTestPigeons({required String baseDir}) async { for (final String input in inputs) { final String pascalCaseName = _snakeToPascalCase(input); - final Set skipLanguages = - _unsupportedFiles[input] ?? {}; + final Set skipLanguages = + _unsupportedFiles[input] ?? {}; // Generate the default language test plugin output. int generateCode = await runPigeon( input: './pigeons/$input.dart', dartOut: '$sharedDartOutputBase/lib/src/generated/$input.gen.dart', // Android - kotlinOut: skipLanguages.contains(GeneratorLanguages.kotlin) + kotlinOut: skipLanguages.contains(GeneratorLanguage.kotlin) ? null : '$outputBase/android/src/main/kotlin/com/example/test_plugin/$pascalCaseName.gen.kt', kotlinPackage: 'com.example.test_plugin', kotlinErrorClassName: '${pascalCaseName}Error', // iOS - swiftOut: skipLanguages.contains(GeneratorLanguages.swift) + swiftOut: skipLanguages.contains(GeneratorLanguage.swift) ? null : '$outputBase/ios/Classes/$pascalCaseName.gen.swift', // Windows - cppHeaderOut: skipLanguages.contains(GeneratorLanguages.cpp) + cppHeaderOut: skipLanguages.contains(GeneratorLanguage.cpp) ? null : '$outputBase/windows/pigeon/$input.gen.h', - cppSourceOut: skipLanguages.contains(GeneratorLanguages.cpp) + cppSourceOut: skipLanguages.contains(GeneratorLanguage.cpp) ? null : '$outputBase/windows/pigeon/$input.gen.cpp', cppNamespace: '${input}_pigeontest', @@ -114,7 +115,7 @@ Future generateTestPigeons({required String baseDir}) async { // single invocation. generateCode = await runPigeon( input: './pigeons/$input.dart', - swiftOut: skipLanguages.contains(GeneratorLanguages.swift) + swiftOut: skipLanguages.contains(GeneratorLanguage.swift) ? null : '$outputBase/macos/Classes/$pascalCaseName.gen.swift', suppressVersion: true, @@ -130,16 +131,16 @@ Future generateTestPigeons({required String baseDir}) async { // Android // This doesn't use the '.gen' suffix since Java has strict file naming // rules. - javaOut: skipLanguages.contains(GeneratorLanguages.java) + javaOut: skipLanguages.contains(GeneratorLanguage.java) ? null : '$alternateOutputBase/android/src/main/java/com/example/' 'alternate_language_test_plugin/${_javaFilenameForName(input)}.java', javaPackage: 'com.example.alternate_language_test_plugin', // iOS - objcHeaderOut: skipLanguages.contains(GeneratorLanguages.objc) + objcHeaderOut: skipLanguages.contains(GeneratorLanguage.objc) ? null : '$alternateOutputBase/ios/Classes/$pascalCaseName.gen.h', - objcSourceOut: skipLanguages.contains(GeneratorLanguages.objc) + objcSourceOut: skipLanguages.contains(GeneratorLanguage.objc) ? null : '$alternateOutputBase/ios/Classes/$pascalCaseName.gen.m', suppressVersion: true, @@ -154,10 +155,10 @@ Future generateTestPigeons({required String baseDir}) async { // single invocation. generateCode = await runPigeon( input: './pigeons/$input.dart', - objcHeaderOut: skipLanguages.contains(GeneratorLanguages.objc) + objcHeaderOut: skipLanguages.contains(GeneratorLanguage.objc) ? null : '$alternateOutputBase/macos/Classes/$pascalCaseName.gen.h', - objcSourceOut: skipLanguages.contains(GeneratorLanguages.objc) + objcSourceOut: skipLanguages.contains(GeneratorLanguage.objc) ? null : '$alternateOutputBase/macos/Classes/$pascalCaseName.gen.m', suppressVersion: true, @@ -234,7 +235,17 @@ Future runPigeon({ /// This is intended for formatting generated output, but since there's no /// way to filter to specific files in with the repo tooling it runs over the /// entire package. -Future formatAllFiles({required String repositoryRoot}) { +Future formatAllFiles({ + required String repositoryRoot, + Set languages = const { + GeneratorLanguage.cpp, + GeneratorLanguage.dart, + GeneratorLanguage.java, + GeneratorLanguage.kotlin, + GeneratorLanguage.objc, + GeneratorLanguage.swift, + }, +}) { final String dartCommand = Platform.isWindows ? 'dart.exe' : 'dart'; return runProcess( dartCommand, @@ -242,8 +253,28 @@ Future formatAllFiles({required String repositoryRoot}) { 'run', 'script/tool/bin/flutter_plugin_tools.dart', 'format', - '--no-swift', '--packages=pigeon', + if (languages.contains(GeneratorLanguage.cpp) || + languages.contains(GeneratorLanguage.objc)) + '--clang-format' + else + '--no-clang-format', + if (languages.contains(GeneratorLanguage.java)) + '--java' + else + '--no-java', + if (languages.contains(GeneratorLanguage.dart)) + '--dart' + else + '--no-dart', + if (languages.contains(GeneratorLanguage.kotlin)) + '--kotlin' + else + '--no-kotlin', + if (languages.contains(GeneratorLanguage.swift)) + '--swift' + else + '--no-swift', ], workingDirectory: repositoryRoot, streamOutput: false, diff --git a/packages/quick_actions/quick_actions_ios/ios/Classes/messages.g.swift b/packages/quick_actions/quick_actions_ios/ios/Classes/messages.g.swift index 0dec7a61994..ed2b5828085 100644 --- a/packages/quick_actions/quick_actions_ios/ios/Classes/messages.g.swift +++ b/packages/quick_actions/quick_actions_ios/ios/Classes/messages.g.swift @@ -5,12 +5,13 @@ // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif extension FlutterError: Error {} @@ -28,13 +29,13 @@ private func wrapError(_ error: Any) -> [Any?] { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } @@ -76,10 +77,10 @@ struct ShortcutItemMessage { private class IOSQuickActionsApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return ShortcutItemMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return ShortcutItemMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -124,7 +125,9 @@ class IOSQuickActionsApiSetup { /// Sets up an instance of `IOSQuickActionsApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: IOSQuickActionsApi?) { /// Sets the dynamic shortcuts for the app. - let setShortcutItemsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsApi.setShortcutItems", binaryMessenger: binaryMessenger, codec: codec) + let setShortcutItemsChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsApi.setShortcutItems", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setShortcutItemsChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -140,7 +143,9 @@ class IOSQuickActionsApiSetup { setShortcutItemsChannel.setMessageHandler(nil) } /// Removes all dynamic shortcuts. - let clearShortcutItemsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsApi.clearShortcutItems", binaryMessenger: binaryMessenger, codec: codec) + let clearShortcutItemsChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsApi.clearShortcutItems", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { clearShortcutItemsChannel.setMessageHandler { _, reply in do { @@ -158,16 +163,21 @@ class IOSQuickActionsApiSetup { /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol IOSQuickActionsFlutterApiProtocol { /// Sends a string representing a shortcut from the native platform to the app. - func launchAction(action actionArg: String, completion: @escaping (Result) -> Void) + func launchAction( + action actionArg: String, completion: @escaping (Result) -> Void) } class IOSQuickActionsFlutterApi: IOSQuickActionsFlutterApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } /// Sends a string representing a shortcut from the native platform to the app. - func launchAction(action actionArg: String, completion: @escaping (Result) -> Void) { - let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsFlutterApi.launchAction", binaryMessenger: binaryMessenger) + func launchAction( + action actionArg: String, completion: @escaping (Result) -> Void + ) { + let channel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsFlutterApi.launchAction", + binaryMessenger: binaryMessenger) channel.sendMessage([actionArg] as [Any?]) { _ in completion(.success(Void())) } diff --git a/script/tool/lib/src/format_command.dart b/script/tool/lib/src/format_command.dart index c0030949086..f2713666435 100644 --- a/script/tool/lib/src/format_command.dart +++ b/script/tool/lib/src/format_command.dart @@ -179,10 +179,8 @@ class FormatCommand extends PackageCommand { } Future _formatAndLintSwift(Iterable files) async { - // TODO(jmagman): Remove generated file filter when pigeon Swift generation matches swift-format. - // https://github.com/flutter/flutter/issues/141799 - final Iterable swiftFiles = _filterGeneratedFiles( - _getPathsWithExtensions(files, {'.swift'})); + final Iterable swiftFiles = + _getPathsWithExtensions(files, {'.swift'}); if (swiftFiles.isNotEmpty) { final String swiftFormat = await _findValidSwiftFormat(); print('Formatting .swift files...'); @@ -359,13 +357,6 @@ class FormatCommand extends PackageCommand { (String filePath) => extensions.contains(path.extension(filePath))); } - Iterable _filterGeneratedFiles(Iterable files) { - return files.where((String filePath) { - final String basename = path.basename(filePath); - return !basename.contains('.gen.') && !basename.contains('.g.'); - }); - } - Future _getJavaFormatterPath() async { final String javaFormatterPath = path.join( path.dirname(path.fromUri(platform.script)), diff --git a/script/tool/test/format_command_test.dart b/script/tool/test/format_command_test.dart index 846466e2aad..cc6019862ba 100644 --- a/script/tool/test/format_command_test.dart +++ b/script/tool/test/format_command_test.dart @@ -573,22 +573,6 @@ void main() { ])); }); - test('skips generated Swift files', () async { - const List files = [ - 'macos/foo.gen.swift', - 'macos/foo.g.swift', - ]; - createFakePlugin( - 'a_plugin', - packagesDir, - extraFiles: files, - ); - - await runCapturingPrint(runner, ['format', '--swift']); - - expect(processRunner.recordedCalls, orderedEquals([])); - }); - test('skips Swift if --no-swift flag is provided', () async { const List files = [ 'macos/foo.swift', From 906909bee723b5c2965b4b21a08375f6a56d4f6b Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Sat, 20 Jan 2024 17:17:02 -0800 Subject: [PATCH 10/11] Update platform label rules for shared iOS/macOS (#5801) Update automatic platform label rules for more implementations that are shared between iOS and macOS. --- .github/labeler.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/labeler.yml b/.github/labeler.yml index a6b295e0166..a967a52b74c 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -212,9 +212,13 @@ 'platform-ios': - changed-files: - any-glob-to-any-file: + - packages/*/*_avfoundation/**/* + - packages/*/*_darwin/**/* + - packages/*/*_foundation/**/* - packages/*/*_ios/**/* - packages/*/*_storekit/**/* - packages/*/*_wkwebview/**/* + - packages/**/darwin/**/* - packages/**/ios/**/* 'platform-linux': @@ -226,7 +230,12 @@ 'platform-macos': - changed-files: - any-glob-to-any-file: + - packages/*/*_avfoundation/**/* + - packages/*/*_darwin/**/* + - packages/*/*_foundation/**/* - packages/*/*_macos/**/* + - packages/*/*_storekit/**/* + - packages/**/darwin/**/* - packages/**/macos/**/* 'platform-web': From e4cbf235ec4d2c0286e6abce2a802560b1d8e1b4 Mon Sep 17 00:00:00 2001 From: engine-flutter-autoroll Date: Sun, 21 Jan 2024 12:42:24 -0500 Subject: [PATCH 11/11] Roll Flutter from ddf60fb08733 to 5dea6b994e8f (5 revisions) (#5951) https://github.com/flutter/flutter/compare/ddf60fb08733...5dea6b994e8f 2024-01-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from 2b31ad2fb819 to a7b207d5a1fe (1 revision) (flutter/flutter#141945) 2024-01-21 christopherfujino@gmail.com [flutter_tools] update analyze_once_test.dart to be null-safe (flutter/flutter#141790) 2024-01-21 linxunfeng@yeah.net Adjust the position of require File.expand_path (flutter/flutter#141521) 2024-01-21 yjbanov@google.com Add RadioListItem use-case to a11y_assessments (flutter/flutter#140984) 2024-01-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 704ef3399012 to 2b31ad2fb819 (1 revision) (flutter/flutter#141937) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC dit@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md --- .ci/flutter_master.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/flutter_master.version b/.ci/flutter_master.version index ac8efc0789b..ddee794e68f 100644 --- a/.ci/flutter_master.version +++ b/.ci/flutter_master.version @@ -1 +1 @@ -ddf60fb087339ed1f886e7091794dde3c0d97d54 +5dea6b994e8ff74c329e5d07a497117578d03710