diff --git a/.ci/flutter_master.version b/.ci/flutter_master.version index d31606cf81f..7703b6b6c00 100644 --- a/.ci/flutter_master.version +++ b/.ci/flutter_master.version @@ -1 +1 @@ -30e53b0d9caadce80eff6d09f6975046b9a93033 +cfb887cd5f4156d95aea91b7c03c3b22b6a8e9b9 diff --git a/AUTHORS b/AUTHORS index be6c57cfb16..b60279e3f60 100644 --- a/AUTHORS +++ b/AUTHORS @@ -78,3 +78,4 @@ Taskulu LDA Alexander Rabin LinXunFeng Hashir Shoaib +Ricardo Dalarme diff --git a/CODEOWNERS b/CODEOWNERS index b9ccecb76bf..3ae1232b840 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -84,7 +84,7 @@ packages/path_provider/path_provider_android/** @camsim99 packages/quick_actions/quick_actions_android/** @camsim99 packages/shared_preferences/shared_preferences_android/** @reidbaker packages/url_launcher/url_launcher_android/** @gmackall -packages/video_player/video_player_android/** @camsim99 @matanlurey +packages/video_player/video_player_android/** @camsim99 # Owned by ecosystem team for now during the wrapper evaluation. packages/webview_flutter/webview_flutter_android/** @bparrishMines diff --git a/packages/camera/camera_android/android/src/test/java/io/flutter/plugins/camera/CameraTest.java b/packages/camera/camera_android/android/src/test/java/io/flutter/plugins/camera/CameraTest.java index 56a3a4562ad..323e167a5cb 100644 --- a/packages/camera/camera_android/android/src/test/java/io/flutter/plugins/camera/CameraTest.java +++ b/packages/camera/camera_android/android/src/test/java/io/flutter/plugins/camera/CameraTest.java @@ -663,7 +663,7 @@ public void setDescriptionWhileRecording_errorsWhenUnsupported() { camera.mediaRecorder = mockMediaRecorder; camera.recordingVideo = true; camera.videoRenderer = mockVideoRenderer; - SdkCapabilityChecker.SDK_VERSION = Build.VERSION_CODES.LOLLIPOP; + SdkCapabilityChecker.SDK_VERSION = Build.VERSION_CODES.N; final CameraProperties newCameraProperties = mock(CameraProperties.class); assertThrows( diff --git a/packages/camera/camera_android/example/android/build.gradle b/packages/camera/camera_android/example/android/build.gradle index da206c42e3c..0e991044a09 100644 --- a/packages/camera/camera_android/example/android/build.gradle +++ b/packages/camera/camera_android/example/android/build.gradle @@ -30,7 +30,8 @@ tasks.register("clean", Delete) { gradle.projectsEvaluated { project(":camera_android") { tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" + // Ignore classfile due to https://issuetracker.google.com/issues/342067844 + options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" } } } diff --git a/packages/camera/camera_avfoundation/CHANGELOG.md b/packages/camera/camera_avfoundation/CHANGELOG.md index c0dad2343bc..113f2583fb2 100644 --- a/packages/camera/camera_avfoundation/CHANGELOG.md +++ b/packages/camera/camera_avfoundation/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.9.18+14 + +* Creates Swift Package Manager target for Swift implementation. + ## 0.9.18+13 * Migrates test utils and mocks to Swift. diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/AvailableCamerasTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/AvailableCamerasTests.swift index e86c51dfd87..c2fd88f2aec 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/AvailableCamerasTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/AvailableCamerasTests.swift @@ -7,6 +7,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + final class AvailableCamerasTest: XCTestCase { private func createCameraPlugin(with deviceDiscoverer: MockCameraDeviceDiscoverer) -> CameraPlugin { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraCaptureSessionQueueRaceConditionTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraCaptureSessionQueueRaceConditionTests.swift index e2698456838..7f6b86cca08 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraCaptureSessionQueueRaceConditionTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraCaptureSessionQueueRaceConditionTests.swift @@ -6,6 +6,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + final class CameraCaptureSessionQueueRaceConditionTests: XCTestCase { private func createCameraPlugin() -> CameraPlugin { return CameraPlugin( diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraMethodChannelTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraMethodChannelTests.swift index a9787b91fcf..d067ddc9839 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraMethodChannelTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraMethodChannelTests.swift @@ -7,6 +7,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + final class CameraMethodChannelTests: XCTestCase { private func createCameraPlugin(with session: MockCaptureSession) -> CameraPlugin { return CameraPlugin( diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraOrientationTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraOrientationTests.swift index 62cecea756e..0fc47b518ab 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraOrientationTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraOrientationTests.swift @@ -8,6 +8,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + private final class MockUIDevice: UIDevice { var mockOrientation: UIDeviceOrientation = .unknown diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPermissionTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPermissionTests.swift index 511e6b6a152..5a963fbf4bc 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPermissionTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPermissionTests.swift @@ -7,6 +7,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + private final class MockPermissionService: NSObject, FLTPermissionServicing { var authorizationStatusStub: ((AVMediaType) -> AVAuthorizationStatus)? var requestAccessStub: ((AVMediaType, @escaping (Bool) -> Void) -> Void)? diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPluginCreateCameraTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPluginCreateCameraTests.swift index dd044b96909..e1f41dc7fe9 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPluginCreateCameraTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPluginCreateCameraTests.swift @@ -6,6 +6,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + final class CameraPluginCreateCameraTests: XCTestCase { private func createCameraPlugin() -> ( CameraPlugin, MockFLTCameraPermissionManager, MockCaptureSession diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPluginDelegatingMethodTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPluginDelegatingMethodTests.swift index b4237d8d638..7010e80afd2 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPluginDelegatingMethodTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPluginDelegatingMethodTests.swift @@ -6,6 +6,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + /// Tests of `CameraPlugin` methods delegating to `FLTCam` instance final class CameraPluginDelegatingMethodTests: XCTestCase { private func createCameraPlugin() -> (CameraPlugin, MockFLTCam) { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPluginInitializeCameraTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPluginInitializeCameraTests.swift index ef6b07010be..92fbf9f7207 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPluginInitializeCameraTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPluginInitializeCameraTests.swift @@ -6,6 +6,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + final class CameraPluginInitializeCameraTests: XCTestCase { private func createCameraPlugin() -> ( CameraPlugin, MockFLTCam, MockGlobalEventApi diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPreviewPauseTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPreviewPauseTests.swift index e9934b93177..d4e7eaf06e2 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPreviewPauseTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPreviewPauseTests.swift @@ -7,6 +7,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + final class CameraPreviewPauseTests: XCTestCase { func testPausePreviewWithResult_shouldPausePreview() { let camera = FLTCam() diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPropertiesTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPropertiesTests.swift index 86de424ea21..e3df38ab8f0 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPropertiesTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraPropertiesTests.swift @@ -8,6 +8,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + final class CameraPropertiesTests: XCTestCase { // MARK: - Flash Mode Tests diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSessionPresetsTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSessionPresetsTests.swift index 07fb2c8ea9b..a0ea59fb452 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSessionPresetsTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSessionPresetsTests.swift @@ -7,6 +7,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + /// Includes test cases related to resolution presets setting operations for FLTCam class. final class CameraSessionPresetsTests: XCTestCase { func testResolutionPresetWithBestFormat_mustUpdateCaptureSessionPreset() { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSettingsTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSettingsTests.swift index c9fa64288be..64b8e10f504 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSettingsTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSettingsTests.swift @@ -7,6 +7,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + private let testResolutionPreset = FCPPlatformResolutionPreset.medium private let testFramesPerSecond = 15 private let testVideoBitrate = 200000 diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraTestUtils.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraTestUtils.swift index 1c978db8edd..805a4095e45 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraTestUtils.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraTestUtils.swift @@ -4,6 +4,13 @@ import Foundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#else + import camera_avfoundation +#endif + /// Utils for creating default class instances used in tests enum CameraTestUtils { /// This method provides a convenient way to create media settings with minimal configuration. diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamExposureTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamExposureTests.swift index f57106999e7..8a749524a8e 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamExposureTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamExposureTests.swift @@ -6,6 +6,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + final class FLTCamExposureTests: XCTestCase { private func createCamera() -> (FLTCam, MockCaptureDevice, MockDeviceOrientationProvider) { let mockDevice = MockCaptureDevice() diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamFocusTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamFocusTests.swift index 6f7d5751e36..1c1090dd74a 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamFocusTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamFocusTests.swift @@ -7,6 +7,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + final class FLTCamSetFocusModeTests: XCTestCase { private func createCamera() -> (FLTCam, MockCaptureDevice, MockDeviceOrientationProvider) { let mockDevice = MockCaptureDevice() diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamSetDeviceOrientationTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamSetDeviceOrientationTests.swift index 68bad3a1c2f..1a915c923bd 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamSetDeviceOrientationTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamSetDeviceOrientationTests.swift @@ -7,6 +7,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + final class FLTCamSetDeviceOrientationTests: XCTestCase { private func createCamera() -> (FLTCam, MockCaptureConnection, MockCaptureConnection) { let configuration = CameraTestUtils.createTestCameraConfiguration() diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamSetFlashModeTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamSetFlashModeTests.swift index f70ce530c6b..16d99c0dc3c 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamSetFlashModeTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamSetFlashModeTests.swift @@ -7,6 +7,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + final class FLTCamSetFlashModeTests: XCTestCase { private func createCamera() -> (FLTCam, MockCaptureDevice, MockCapturePhotoOutput) { let mockDevice = MockCaptureDevice() diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamZoomTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamZoomTests.swift index b3320de2825..add21edbc92 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamZoomTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamZoomTests.swift @@ -7,6 +7,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + final class FLTCamZoomTests: XCTestCase { private func createCamera() -> (FLTCam, MockCaptureDevice) { let mockDevice = MockCaptureDevice() diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockAssetWriter.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockAssetWriter.swift index f47e6852c44..a725e958b05 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockAssetWriter.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockAssetWriter.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + /// Mock implementation of `FLTAssetWriter` protocol which allows injecting a custom /// implementation. final class MockAssetWriter: NSObject, FLTAssetWriter { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockAssetWriterInput.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockAssetWriterInput.swift index 3b06941ab71..cc373a5852f 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockAssetWriterInput.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockAssetWriterInput.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + /// Mock implementation of `FLTAssetWriterInput` protocol which allows injecting a custom /// implementation. final class MockAssetWriterInput: NSObject, FLTAssetWriterInput { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockAssetWriterInputPixelBufferAdaptor.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockAssetWriterInputPixelBufferAdaptor.swift index 20a2ade55c6..0b4069614ca 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockAssetWriterInputPixelBufferAdaptor.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockAssetWriterInputPixelBufferAdaptor.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + /// Mock implementation of `FLTAssetWriterInputPixelBufferAdaptor` protocol which allows injecting a custom /// implementation. final class MockAssetWriterInputPixelBufferAdaptor: NSObject, FLTAssetWriterInputPixelBufferAdaptor diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCameraDeviceDiscoverer.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCameraDeviceDiscoverer.swift index e79a6937834..c8ddda5ee59 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCameraDeviceDiscoverer.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCameraDeviceDiscoverer.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + /// Mock implementation of `FLTCameraDeviceDiscovering` protocol which allows injecting a custom /// implementation for session discovery. final class MockCameraDeviceDiscoverer: NSObject, FLTCameraDeviceDiscovering { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureConnection.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureConnection.swift index c06c352ecb8..a700364818b 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureConnection.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureConnection.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + /// A mock implementation of `FLTCaptureConnection` that allows injecting a custom implementation. final class MockCaptureConnection: NSObject, FLTCaptureConnection { var setVideoOrientationStub: ((AVCaptureVideoOrientation) -> Void)? diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDevice.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDevice.swift index 53886adf8ee..660c1a83d50 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDevice.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDevice.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + /// A mock implementation of `FLTCaptureDevice` that allows mocking the class /// properties. class MockCaptureDevice: NSObject, FLTCaptureDevice { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDeviceFormat.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDeviceFormat.swift index 5e51db2c02a..be58b746c26 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDeviceFormat.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDeviceFormat.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + /// A mock implementation of `FLTCaptureDeviceFormat` that allows mocking the class /// properties. final class MockCaptureDeviceFormat: NSObject, FLTCaptureDeviceFormat { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDeviceInputFactory.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDeviceInputFactory.swift index bbca49a230a..01a20c22a05 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDeviceInputFactory.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDeviceInputFactory.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + ///// A mocked implementation of FLTCaptureDeviceInputFactory which allows injecting a custom ///// implementation. final class MockCaptureDeviceInputFactory: NSObject, FLTCaptureDeviceInputFactory { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureInput.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureInput.swift index 6c8151a1715..9ebf87ccf8b 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureInput.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureInput.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + /// A mocked implementation of FLTCaptureInput which allows injecting a custom /// implementation. final class MockCaptureInput: NSObject, FLTCaptureInput { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCapturePhotoOutput.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCapturePhotoOutput.swift index 788fb147ea4..59e5b1703a1 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCapturePhotoOutput.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCapturePhotoOutput.swift @@ -2,7 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import AVFoundation +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif /// Mock implementation of `FLTCapturePhotoOutput` protocol which allows injecting a custom /// implementation. diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureSession.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureSession.swift index b249f08ea12..9218fa8dd89 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureSession.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureSession.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + /// Mock implementation of `FLTCaptureSession` protocol which allows injecting a custom /// implementation. final class MockCaptureSession: NSObject, FLTCaptureSession { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureVideoDataOutput.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureVideoDataOutput.swift index 690efd38092..05784d652c7 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureVideoDataOutput.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureVideoDataOutput.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + /// Mock implementation of `FLTCaptureVideoDataOutput` protocol which allows injecting a custom /// implementation. class MockCaptureVideoDataOutput: NSObject, FLTCaptureVideoDataOutput { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockDeviceOrientationProvider.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockDeviceOrientationProvider.swift index c28238efd2b..203fa5ba1c7 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockDeviceOrientationProvider.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockDeviceOrientationProvider.swift @@ -2,7 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import Foundation +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif final class MockDeviceOrientationProvider: NSObject, FLTDeviceOrientationProviding { var orientationStub: (() -> UIDeviceOrientation)? diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockEventChannel.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockEventChannel.swift index 84c6a40d30e..7e10b2c3998 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockEventChannel.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockEventChannel.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + /// A mock implementation of `FLTEventChannel` that allows injecting a custom implementation /// for setting a stream handler. final class MockEventChannel: NSObject, FLTEventChannel { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFLTCam.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFLTCam.swift index 828bcc20d97..c4ca7ad9f9f 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFLTCam.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFLTCam.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + final class MockFLTCam: FLTCam { var setOnFrameAvailableStub: ((() -> Void) -> Void)? var setDartApiStub: ((FCPCameraEventApi) -> Void)? diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFLTCameraPermissionManager.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFLTCameraPermissionManager.swift index 61a38735d3c..0a4bdac00ef 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFLTCameraPermissionManager.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFLTCameraPermissionManager.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + final class MockFLTCameraPermissionManager: FLTCameraPermissionManager { var requestCameraPermissionStub: ((((FlutterError?) -> Void)?) -> Void)? var requestAudioPermissionStub: ((((FlutterError?) -> Void)?) -> Void)? diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFlutterBinaryMessenger.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFlutterBinaryMessenger.swift index 0511dd1bfa1..181f1360a8d 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFlutterBinaryMessenger.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFlutterBinaryMessenger.swift @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import Flutter + /// Mocked implementation of `FlutterBinaryMessenger` protocol that exists to allow constructing /// a `CameraPlugin` instance for testing. It contains an empty implementation for all protocol /// methods. diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFlutterTextureRegistry.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFlutterTextureRegistry.swift index c57e7dbbd42..fbaccd8c54b 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFlutterTextureRegistry.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFlutterTextureRegistry.swift @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import Flutter + /// Mocked implementation of `FlutterTextureRegistry` protocol that exists to allow constructing /// a `CameraPlugin` instance for testing. It contains an empty implementation for all protocol /// methods. diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFrameRateRange.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFrameRateRange.swift index 3881309c936..e0010c648e8 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFrameRateRange.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFrameRateRange.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + /// A mock implementation of `FLTFrameRateRange` that allows mocking the class properties. final class MockFrameRateRange: NSObject, FLTFrameRateRange { var minFrameRate: Float diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockGlobalEventApi.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockGlobalEventApi.swift index 5f158ac06b5..e38df02dc73 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockGlobalEventApi.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockGlobalEventApi.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + /// A mock implementation of `FCPCameraGlobalEventApi` that captures received /// `deviceOrientationChanged` events and exposes whether they were received to the testing code. final class MockGlobalEventApi: FCPCameraGlobalEventApi { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockWritableData.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockWritableData.swift index 912c77cb48e..c353a7ac744 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockWritableData.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockWritableData.swift @@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import camera_avfoundation + +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + import camera_avfoundation_objc +#endif + /// A mock implementation of `FLTWritableData` that allows injecting a custom implementation /// for writing to a file. final class MockWritableData: NSObject, FLTWritableData { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/PhotoCaptureTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/PhotoCaptureTests.swift index 58ccc013131..6fbdc1ef04a 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/PhotoCaptureTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/PhotoCaptureTests.swift @@ -7,6 +7,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + /// Includes test cases related to photo capture operations for FLTCam class. final class PhotoCaptureTests: XCTestCase { private func createCam(with captureSessionQueue: DispatchQueue) -> FLTCam { diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/QueueTestUtils.h b/packages/camera/camera_avfoundation/example/ios/RunnerTests/QueueTestUtils.h index ea8e90e821e..0d5d7ee6bd1 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/QueueTestUtils.h +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/QueueTestUtils.h @@ -2,10 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -@import camera_avfoundation; -#if __has_include() -@import camera_avfoundation.Test; -#endif +@import Foundation; NS_ASSUME_NONNULL_BEGIN diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/QueueUtilsTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/QueueUtilsTests.swift index 1153f723999..00384a3c2a1 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/QueueUtilsTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/QueueUtilsTests.swift @@ -6,6 +6,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + final class QueueUtilsTests: XCTestCase { func testShouldStayOnMainQueueIfCalledFromMainQueue() { let expectation = expectation(description: "Block must be run on the main queue") diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/RunnerTests-Bridging-Header.h b/packages/camera/camera_avfoundation/example/ios/RunnerTests/RunnerTests-Bridging-Header.h index 84ae19a4e79..d7eaeeac4e1 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/RunnerTests-Bridging-Header.h +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/RunnerTests-Bridging-Header.h @@ -2,14 +2,5 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Sources. -#import "camera_avfoundation/CameraPlugin.h" -#import "camera_avfoundation/CameraPlugin_Test.h" -#import "camera_avfoundation/FLTCamConfiguration.h" -#import "camera_avfoundation/FLTCam_Test.h" -#import "camera_avfoundation/FLTSavePhotoDelegate.h" -#import "camera_avfoundation/FLTThreadSafeEventChannel.h" - -// Utils. #import "ExceptionCatcher.h" #import "QueueTestUtils.h" diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/SampleBufferTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/SampleBufferTests.swift index 932f93ee5d5..5b412d07395 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/SampleBufferTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/SampleBufferTests.swift @@ -7,6 +7,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + private class FakeMediaSettingsAVWrapper: FLTCamMediaSettingsAVWrapper { let inputMock: MockAssetWriterInput diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/SavePhotoDelegateTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/SavePhotoDelegateTests.swift index 0e4c2e00441..30d19830406 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/SavePhotoDelegateTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/SavePhotoDelegateTests.swift @@ -7,6 +7,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + final class SavePhotoDelegateTests: XCTestCase { func testHandlePhotoCaptureResult_mustCompleteWithErrorIfFailedToCapture() { let completionExpectation = expectation( diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/StreamingTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/StreamingTests.swift index f164bb6e9a2..c5e9bab66a4 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/StreamingTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/StreamingTests.swift @@ -7,6 +7,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + private class MockImageStreamHandler: FLTImageStreamHandler { var eventSinkStub: ((Any?) -> Void)? diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/ThreadSafeEventChannelTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/ThreadSafeEventChannelTests.swift index 5e0790d22f3..5b588ef4f2b 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/ThreadSafeEventChannelTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/ThreadSafeEventChannelTests.swift @@ -6,6 +6,11 @@ import XCTest @testable import camera_avfoundation +// Import Objectice-C part of the implementation when SwiftPM is used. +#if canImport(camera_avfoundation_objc) + @testable import camera_avfoundation_objc +#endif + final class ThreadSafeEventChannelTests: XCTestCase { func testSetStreamHandler_shouldStayOnMainThreadIfCalledFromMainThread() { let mockEventChannel = MockEventChannel() diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation.podspec b/packages/camera/camera_avfoundation/ios/camera_avfoundation.podspec index 74594ff30e6..c52072da951 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation.podspec +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation.podspec @@ -13,9 +13,15 @@ A Flutter plugin to use the camera from your Flutter app. s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/camera_avfoundation' } s.documentation_url = 'https://pub.dev/packages/camera_avfoundation' - s.source_files = 'camera_avfoundation/Sources/camera_avfoundation/**/*.{h,m}' - s.public_header_files = 'camera_avfoundation/Sources/camera_avfoundation/include/**/*.h' - s.module_map = 'camera_avfoundation/Sources/camera_avfoundation/include/CameraPlugin.modulemap' + # Combine camera_avfoundation and camera_avfoundation_objc sources into a single pod, unlike + # SwiftPM, where separate Swift and Objective-C targets are required. + s.source_files = 'camera_avfoundation/Sources/camera_avfoundation*/**/*.{h,m,swift}' + s.public_header_files = 'camera_avfoundation/Sources/camera_avfoundation_objc/include/**/*.h' + s.swift_version = '5.0' + s.xcconfig = { + 'LIBRARY_SEARCH_PATHS' => '$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)/ $(SDKROOT)/usr/lib/swift', + 'LD_RUNPATH_SEARCH_PATHS' => '/usr/lib/swift', + } s.dependency 'Flutter' s.platform = :ios, '12.0' diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Package.swift b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Package.swift index 48050b6b788..92047c51c7a 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Package.swift +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Package.swift @@ -12,20 +12,29 @@ let package = Package( .iOS("12.0") ], products: [ - .library(name: "camera-avfoundation", targets: ["camera_avfoundation"]) + .library( + name: "camera-avfoundation", targets: ["camera_avfoundation", "camera_avfoundation_objc"]) ], dependencies: [], targets: [ .target( name: "camera_avfoundation", + dependencies: ["camera_avfoundation_objc"], + path: "Sources/camera_avfoundation", + resources: [ + .process("Resources") + ] + ), + .target( + name: "camera_avfoundation_objc", dependencies: [], - exclude: ["include/camera_avfoundation-umbrella.h", "include/CameraPlugin.modulemap"], + path: "Sources/camera_avfoundation_objc", resources: [ .process("Resources") ], cSettings: [ .headerSearchPath("include/camera_avfoundation") ] - ) + ), ] ) diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/Placeholder.swift b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/Placeholder.swift new file mode 100644 index 00000000000..e7217c7d7b3 --- /dev/null +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/Placeholder.swift @@ -0,0 +1,3 @@ +// 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. diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/CameraPlugin.modulemap b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/CameraPlugin.modulemap deleted file mode 100644 index 0a793ec38ce..00000000000 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/CameraPlugin.modulemap +++ /dev/null @@ -1,29 +0,0 @@ -framework module camera_avfoundation { - umbrella header "camera_avfoundation-umbrella.h" - - export * - module * { export * } - - explicit module Test { - header "FLTAssetWriter.h" - header "FLTCameraDeviceDiscovering.h" - header "FLTCaptureConnection.h" - header "FLTCaptureDevice.h" - header "FLTCaptureDeviceFormat.h" - header "FLTCapturePhotoOutput.h" - header "FLTCaptureSession.h" - header "FLTDeviceOrientationProviding.h" - header "FLTEventChannel.h" - header "FLTWritableData.h" - header "FLTPermissionServicing.h" - header "CameraPlugin_Test.h" - header "CameraProperties.h" - header "FLTCam.h" - header "FLTCam_Test.h" - header "FLTCamConfiguration.h" - header "FLTSavePhotoDelegate_Test.h" - header "FLTThreadSafeEventChannel.h" - header "FLTCameraPermissionManager.h" - header "QueueUtils.h" - } -} diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation-umbrella.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation-umbrella.h deleted file mode 100644 index f8464aaae3d..00000000000 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation-umbrella.h +++ /dev/null @@ -1,9 +0,0 @@ -// 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. - -#import -#import - -FOUNDATION_EXPORT double cameraVersionNumber; -FOUNDATION_EXPORT const unsigned char cameraVersionString[]; diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/CameraPlugin.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/CameraPlugin.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraProperties.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/CameraProperties.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraProperties.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/CameraProperties.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTAssetWriter.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTAssetWriter.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTAssetWriter.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTAssetWriter.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCam.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCam.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCam.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCam.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCamConfiguration.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCamConfiguration.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCamConfiguration.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCamConfiguration.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCamMediaSettingsAVWrapper.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCamMediaSettingsAVWrapper.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCamMediaSettingsAVWrapper.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCamMediaSettingsAVWrapper.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCameraDeviceDiscovering.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCameraDeviceDiscovering.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCameraDeviceDiscovering.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCameraDeviceDiscovering.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCameraPermissionManager.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCameraPermissionManager.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCameraPermissionManager.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCameraPermissionManager.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCaptureConnection.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCaptureConnection.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCaptureConnection.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCaptureConnection.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCaptureDevice.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCaptureDevice.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCaptureDevice.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCaptureDevice.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCaptureDeviceFormat.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCaptureDeviceFormat.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCaptureDeviceFormat.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCaptureDeviceFormat.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCapturePhotoOutput.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCapturePhotoOutput.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCapturePhotoOutput.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCapturePhotoOutput.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCaptureSession.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCaptureSession.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCaptureSession.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCaptureSession.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCaptureVideoDataOutput.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCaptureVideoDataOutput.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCaptureVideoDataOutput.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCaptureVideoDataOutput.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTDeviceOrientationProviding.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTDeviceOrientationProviding.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTDeviceOrientationProviding.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTDeviceOrientationProviding.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTPermissionServicing.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTPermissionServicing.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTPermissionServicing.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTPermissionServicing.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTSavePhotoDelegate.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTSavePhotoDelegate.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTSavePhotoDelegate.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTSavePhotoDelegate.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTThreadSafeEventChannel.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTThreadSafeEventChannel.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTThreadSafeEventChannel.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTThreadSafeEventChannel.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTWritableData.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTWritableData.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTWritableData.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTWritableData.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/QueueUtils.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/QueueUtils.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/QueueUtils.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/QueueUtils.m diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/Resources/PrivacyInfo.xcprivacy b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 00000000000..a34b7e2e60c --- /dev/null +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,14 @@ + + + + + NSPrivacyTrackingDomains + + NSPrivacyAccessedAPITypes + + NSPrivacyCollectedDataTypes + + NSPrivacyTracking + + + diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/CameraPlugin.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/CameraPlugin.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/CameraPlugin.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/CameraPlugin.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/CameraPlugin_Test.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/CameraPlugin_Test.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/CameraPlugin_Test.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/CameraPlugin_Test.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/CameraProperties.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/CameraProperties.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/CameraProperties.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/CameraProperties.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTAssetWriter.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTAssetWriter.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTAssetWriter.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTAssetWriter.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCam.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCam.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCam.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCam.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCamConfiguration.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCamConfiguration.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCamConfiguration.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCamConfiguration.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCamMediaSettingsAVWrapper.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCamMediaSettingsAVWrapper.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCamMediaSettingsAVWrapper.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCamMediaSettingsAVWrapper.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCam_Test.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCam_Test.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCam_Test.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCam_Test.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCameraDeviceDiscovering.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCameraDeviceDiscovering.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCameraDeviceDiscovering.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCameraDeviceDiscovering.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCameraPermissionManager.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCameraPermissionManager.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCameraPermissionManager.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCameraPermissionManager.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCaptureConnection.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureConnection.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCaptureConnection.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureConnection.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCaptureDevice.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureDevice.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCaptureDevice.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureDevice.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCaptureDeviceFormat.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureDeviceFormat.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCaptureDeviceFormat.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureDeviceFormat.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCaptureOutput.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureOutput.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCaptureOutput.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureOutput.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCapturePhotoOutput.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCapturePhotoOutput.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCapturePhotoOutput.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCapturePhotoOutput.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCaptureSession.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureSession.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCaptureSession.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureSession.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCaptureVideoDataOutput.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureVideoDataOutput.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTCaptureVideoDataOutput.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureVideoDataOutput.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTDeviceOrientationProviding.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTDeviceOrientationProviding.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTDeviceOrientationProviding.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTDeviceOrientationProviding.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTEventChannel.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTEventChannel.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTEventChannel.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTEventChannel.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTPermissionServicing.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTPermissionServicing.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTPermissionServicing.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTPermissionServicing.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTSavePhotoDelegate.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTSavePhotoDelegate.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTSavePhotoDelegate.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTSavePhotoDelegate.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTSavePhotoDelegate_Test.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTSavePhotoDelegate_Test.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTSavePhotoDelegate_Test.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTSavePhotoDelegate_Test.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTThreadSafeEventChannel.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTThreadSafeEventChannel.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTThreadSafeEventChannel.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTThreadSafeEventChannel.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTWritableData.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTWritableData.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/FLTWritableData.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTWritableData.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/QueueUtils.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/QueueUtils.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/messages.g.h similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/messages.g.h diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/messages.g.m similarity index 100% rename from packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m rename to packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/messages.g.m diff --git a/packages/camera/camera_avfoundation/pubspec.yaml b/packages/camera/camera_avfoundation/pubspec.yaml index 66dffba0df0..1d40fd04c63 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.18+13 +version: 0.9.18+14 environment: sdk: ^3.4.0 diff --git a/packages/espresso/CHANGELOG.md b/packages/espresso/CHANGELOG.md index 094357ea431..60b8d79482e 100644 --- a/packages/espresso/CHANGELOG.md +++ b/packages/espresso/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.0+7 + +* Removes obsolete code related to supporting SDK <21. + ## 0.4.0+6 * Updates compileSdk 34 to flutter.compileSdkVersion. diff --git a/packages/espresso/README.md b/packages/espresso/README.md index 0e0d7880a9d..08c9b62c9d9 100644 --- a/packages/espresso/README.md +++ b/packages/espresso/README.md @@ -4,7 +4,7 @@ Provides bindings for Espresso tests of Flutter Android apps. | | Android | |-------------|---------| -| **Support** | SDK 16+ | +| **Support** | SDK 21+ | ## Installation diff --git a/packages/espresso/android/build.gradle b/packages/espresso/android/build.gradle index 1ed26fe26f3..aa1221da4a1 100644 --- a/packages/espresso/android/build.gradle +++ b/packages/espresso/android/build.gradle @@ -26,7 +26,7 @@ android { compileSdk = flutter.compileSdkVersion defaultConfig { - minSdkVersion 19 + minSdkVersion 21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/packages/espresso/pubspec.yaml b/packages/espresso/pubspec.yaml index 5da148fb4a4..bba71351f0f 100644 --- a/packages/espresso/pubspec.yaml +++ b/packages/espresso/pubspec.yaml @@ -3,7 +3,7 @@ description: Java classes for testing Flutter apps using Espresso. Allows driving Flutter widgets from a native Espresso test. repository: https://github.com/flutter/packages/tree/main/packages/espresso issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+espresso%22 -version: 0.4.0+6 +version: 0.4.0+7 environment: sdk: ^3.6.0 diff --git a/packages/file_selector/file_selector/CHANGELOG.md b/packages/file_selector/file_selector/CHANGELOG.md index 565150b325c..01103740414 100644 --- a/packages/file_selector/file_selector/CHANGELOG.md +++ b/packages/file_selector/file_selector/CHANGELOG.md @@ -1,5 +1,6 @@ ## NEXT +* Updates README to indicate that Andoid SDK <21 is no longer supported. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 1.0.3 diff --git a/packages/file_selector/file_selector/README.md b/packages/file_selector/file_selector/README.md index b316a468713..13327f9e1db 100644 --- a/packages/file_selector/file_selector/README.md +++ b/packages/file_selector/file_selector/README.md @@ -8,7 +8,7 @@ A Flutter plugin that manages files and interactions with file dialogs. | | Android | iOS | Linux | macOS | Web | Windows | |-------------|---------|---------|-------|--------|-----|-------------| -| **Support** | SDK 19+ | iOS 12+ | Any | 10.14+ | Any | Windows 10+ | +| **Support** | SDK 21+ | iOS 12+ | Any | 10.14+ | Any | Windows 10+ | ## Setup @@ -114,9 +114,7 @@ pass different `XTypeGroup`s based on `Platform`. | Choose a single file | Pick a file/image | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | Choose multiple files | Pick multiple files/images | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | Choose a save location | Pick a directory to save a file in | ❌ | ❌ | ✔️ | ✔️ | ✔️ | ❌ | -| Choose a directory | Pick a directory and get its path | ✔️† | ❌ | ✔️ | ✔️ | ✔️ | ❌ | - -† Choosing a directory is no supported on versions of Android before SDK 21 (Lollipop). +| Choose a directory | Pick a directory and get its path | ✔️ | ❌ | ✔️ | ✔️ | ✔️ | ❌ | [example]:./example [entitlement]: https://docs.flutter.dev/desktop#entitlements-and-the-app-sandbox diff --git a/packages/file_selector/file_selector_android/CHANGELOG.md b/packages/file_selector/file_selector_android/CHANGELOG.md index 99162a489f6..5287f02fe8c 100644 --- a/packages/file_selector/file_selector_android/CHANGELOG.md +++ b/packages/file_selector/file_selector_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.1+14 + +* Removes obsolete code related to supporting SDK <21. + ## 0.5.1+13 * Updates compileSdk 34 to flutter.compileSdkVersion. diff --git a/packages/file_selector/file_selector_android/android/build.gradle b/packages/file_selector/file_selector_android/android/build.gradle index 37cdd098c2b..e4b815417fc 100644 --- a/packages/file_selector/file_selector_android/android/build.gradle +++ b/packages/file_selector/file_selector_android/android/build.gradle @@ -31,7 +31,7 @@ android { } defaultConfig { - minSdkVersion 19 + minSdkVersion 21 } dependencies { diff --git a/packages/file_selector/file_selector_android/android/src/main/java/dev/flutter/packages/file_selector_android/FileSelectorApiImpl.java b/packages/file_selector/file_selector_android/android/src/main/java/dev/flutter/packages/file_selector_android/FileSelectorApiImpl.java index 37d38c2f508..d436f4f087c 100644 --- a/packages/file_selector/file_selector_android/android/src/main/java/dev/flutter/packages/file_selector_android/FileSelectorApiImpl.java +++ b/packages/file_selector/file_selector_android/android/src/main/java/dev/flutter/packages/file_selector_android/FileSelectorApiImpl.java @@ -6,7 +6,6 @@ import static dev.flutter.packages.file_selector_android.FileUtils.FILE_SELECTOR_EXCEPTION_PLACEHOLDER_PATH; -import android.annotation.TargetApi; import android.app.Activity; import android.content.ClipData; import android.content.ContentResolver; @@ -193,17 +192,9 @@ public void onResult(int resultCode, @Nullable Intent data) { } @Override - @TargetApi(21) public void getDirectoryPath( @Nullable String initialDirectory, @NonNull GeneratedFileSelectorApi.NullableResult result) { - if (!sdkChecker.sdkIsAtLeast(android.os.Build.VERSION_CODES.LOLLIPOP)) { - result.error( - new UnsupportedOperationException( - "Selecting a directory is only supported on versions >= 21")); - return; - } - final Intent intent = objectFactory.newIntent(Intent.ACTION_OPEN_DOCUMENT_TREE); trySetInitialDirectory(intent, initialDirectory); diff --git a/packages/file_selector/file_selector_android/android/src/test/java/dev/flutter/packages/file_selector_android/FileSelectorAndroidPluginTest.java b/packages/file_selector/file_selector_android/android/src/test/java/dev/flutter/packages/file_selector_android/FileSelectorAndroidPluginTest.java index b213e85f05c..3000112b5d4 100644 --- a/packages/file_selector/file_selector_android/android/src/test/java/dev/flutter/packages/file_selector_android/FileSelectorAndroidPluginTest.java +++ b/packages/file_selector/file_selector_android/android/src/test/java/dev/flutter/packages/file_selector_android/FileSelectorAndroidPluginTest.java @@ -443,7 +443,7 @@ public void getDirectoryPathReturnsSuccessfully() { new FileSelectorApiImpl( mockActivityBinding, mockObjectFactory, - (version) -> Build.VERSION_CODES.LOLLIPOP >= version); + (version) -> Build.VERSION.SDK_INT >= version); final GeneratedFileSelectorApi.NullableResult mockResult = mock(GeneratedFileSelectorApi.NullableResult.class); @@ -465,20 +465,4 @@ public void getDirectoryPathReturnsSuccessfully() { } } } - - @Test - public void getDirectoryPath_errorsForUnsupportedVersion() { - final FileSelectorApiImpl fileSelectorApi = - new FileSelectorApiImpl( - mockActivityBinding, - mockObjectFactory, - (version) -> Build.VERSION_CODES.KITKAT >= version); - - @SuppressWarnings("unchecked") - final GeneratedFileSelectorApi.NullableResult mockResult = - mock(GeneratedFileSelectorApi.NullableResult.class); - fileSelectorApi.getDirectoryPath(null, mockResult); - - verify(mockResult).error(any()); - } } diff --git a/packages/file_selector/file_selector_android/example/android/build.gradle b/packages/file_selector/file_selector_android/example/android/build.gradle index e4986fb81ee..0794404e2f2 100644 --- a/packages/file_selector/file_selector_android/example/android/build.gradle +++ b/packages/file_selector/file_selector_android/example/android/build.gradle @@ -30,7 +30,8 @@ tasks.register("clean", Delete) { gradle.projectsEvaluated { project(":file_selector_android") { tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" + // Ignore classfile due to https://issuetracker.google.com/issues/342067844 + options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" } } } diff --git a/packages/file_selector/file_selector_android/pubspec.yaml b/packages/file_selector/file_selector_android/pubspec.yaml index b5e8d2cbf0b..879ff4d0db7 100644 --- a/packages/file_selector/file_selector_android/pubspec.yaml +++ b/packages/file_selector/file_selector_android/pubspec.yaml @@ -2,7 +2,7 @@ name: file_selector_android description: Android implementation of the file_selector package. repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22 -version: 0.5.1+13 +version: 0.5.1+14 environment: sdk: ^3.6.0 diff --git a/packages/flutter_plugin_android_lifecycle/CHANGELOG.md b/packages/flutter_plugin_android_lifecycle/CHANGELOG.md index 1ff1c777f08..c01231c5a8d 100644 --- a/packages/flutter_plugin_android_lifecycle/CHANGELOG.md +++ b/packages/flutter_plugin_android_lifecycle/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.28 + +* Removes obsolete code related to supporting SDK <21. + ## 2.0.27 * Bumps flutter supported version to 3.27 and use flutter.compileSdkVersion. diff --git a/packages/flutter_plugin_android_lifecycle/README.md b/packages/flutter_plugin_android_lifecycle/README.md index 69a5be88f9d..b2e321cfbef 100644 --- a/packages/flutter_plugin_android_lifecycle/README.md +++ b/packages/flutter_plugin_android_lifecycle/README.md @@ -11,7 +11,7 @@ major version of the Android `Lifecycle` API they expect. | | Android | |-------------|---------| -| **Support** | SDK 16+ | +| **Support** | SDK 21+ | ## Example diff --git a/packages/flutter_plugin_android_lifecycle/android/build.gradle b/packages/flutter_plugin_android_lifecycle/android/build.gradle index 86ed276837d..8788183b1a5 100644 --- a/packages/flutter_plugin_android_lifecycle/android/build.gradle +++ b/packages/flutter_plugin_android_lifecycle/android/build.gradle @@ -26,7 +26,7 @@ android { compileSdk = flutter.compileSdkVersion defaultConfig { - minSdkVersion 19 + minSdkVersion 21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles 'proguard.txt' } diff --git a/packages/flutter_plugin_android_lifecycle/pubspec.yaml b/packages/flutter_plugin_android_lifecycle/pubspec.yaml index 63ca1c8faa9..a5e542c63af 100644 --- a/packages/flutter_plugin_android_lifecycle/pubspec.yaml +++ b/packages/flutter_plugin_android_lifecycle/pubspec.yaml @@ -2,7 +2,7 @@ name: flutter_plugin_android_lifecycle description: Flutter plugin for accessing an Android Lifecycle within other plugins. repository: https://github.com/flutter/packages/tree/main/packages/flutter_plugin_android_lifecycle issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_plugin_android_lifecycle%22 -version: 2.0.27 +version: 2.0.28 environment: sdk: ^3.6.0 diff --git a/packages/go_router/CHANGELOG.md b/packages/go_router/CHANGELOG.md index 19a6cdf7061..2c80a43d6e1 100644 --- a/packages/go_router/CHANGELOG.md +++ b/packages/go_router/CHANGELOG.md @@ -1,3 +1,10 @@ +## 15.0.0 + +- **BREAKING CHANGE** + - URLs are now case sensitive. + - Adds `caseSensitive` parameter to `GoRouter` (default to `true`). + - See [Migrating to 15.0.0](https://flutter.dev/go/go-router-v15-breaking-changes) + ## 14.8.1 - Secured canPop method for the lack of matches in routerDelegate's configuration. diff --git a/packages/go_router/README.md b/packages/go_router/README.md index 12da5815576..8f54d8e10e1 100644 --- a/packages/go_router/README.md +++ b/packages/go_router/README.md @@ -37,6 +37,7 @@ See the API documentation for details on the following topics: - [Error handling](https://pub.dev/documentation/go_router/latest/topics/Error%20handling-topic.html) ## Migration Guides +- [Migrating to 15.0.0](https://flutter.dev/go/go-router-v15-breaking-changes). - [Migrating to 14.0.0](https://flutter.dev/go/go-router-v14-breaking-changes). - [Migrating to 13.0.0](https://flutter.dev/go/go-router-v13-breaking-changes). - [Migrating to 12.0.0](https://flutter.dev/go/go-router-v12-breaking-changes). diff --git a/packages/go_router/lib/src/match.dart b/packages/go_router/lib/src/match.dart index 696f9d4c50d..051c8b74960 100644 --- a/packages/go_router/lib/src/match.dart +++ b/packages/go_router/lib/src/match.dart @@ -218,7 +218,17 @@ abstract class RouteMatchBase with Diagnosticable { final String newMatchedLocation = concatenatePaths(matchedLocation, pathLoc); final String newMatchedPath = concatenatePaths(matchedPath, route.path); - if (newMatchedLocation.toLowerCase() == uri.path.toLowerCase()) { + + final String newMatchedLocationToCompare; + final String uriPathToCompare; + if (route.caseSensitive) { + newMatchedLocationToCompare = newMatchedLocation; + uriPathToCompare = uri.path; + } else { + newMatchedLocationToCompare = newMatchedLocation.toLowerCase(); + uriPathToCompare = uri.path.toLowerCase(); + } + if (newMatchedLocationToCompare == uriPathToCompare) { // A complete match. pathParameters.addAll(currentPathParameter); @@ -232,7 +242,7 @@ abstract class RouteMatchBase with Diagnosticable { ], }; } - assert(uri.path.startsWith(newMatchedLocation)); + assert(uriPathToCompare.startsWith(newMatchedLocationToCompare)); assert(remainingLocation.isNotEmpty); final String childRestLoc = uri.path.substring( diff --git a/packages/go_router/lib/src/route.dart b/packages/go_router/lib/src/route.dart index 703e470e9a6..d16e1dfd658 100644 --- a/packages/go_router/lib/src/route.dart +++ b/packages/go_router/lib/src/route.dart @@ -275,6 +275,7 @@ class GoRoute extends RouteBase { super.parentNavigatorKey, super.redirect, this.onExit, + this.caseSensitive = true, super.routes = const [], }) : assert(path.isNotEmpty, 'GoRoute path cannot be empty'), assert(name == null || name.isNotEmpty, 'GoRoute name cannot be empty'), @@ -437,6 +438,17 @@ class GoRoute extends RouteBase { /// ``` final ExitCallback? onExit; + /// Determines whether the route matching is case sensitive. + /// + /// When `true`, the path must match the specified case. For example, + /// a [GoRoute] with `path: '/family/:fid'` will not match `/FaMiLy/f2`. + /// + /// When `false`, the path matching is case insensitive. The route + /// with `path: '/family/:fid'` will match `/FaMiLy/f2`. + /// + /// Defaults to `true`. + final bool caseSensitive; + // TODO(chunhtai): move all regex related help methods to path_utils.dart. /// Match this route against a location. RegExpMatch? matchPatternAsPrefix(String loc) { diff --git a/packages/go_router/pubspec.yaml b/packages/go_router/pubspec.yaml index 86b0e9643fa..90bdc10f5e9 100644 --- a/packages/go_router/pubspec.yaml +++ b/packages/go_router/pubspec.yaml @@ -1,7 +1,7 @@ name: go_router description: A declarative router for Flutter based on Navigation 2 supporting deep linking, data-driven routes and more -version: 14.8.1 +version: 15.0.0 repository: https://github.com/flutter/packages/tree/main/packages/go_router issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router%22 diff --git a/packages/go_router/test/go_router_test.dart b/packages/go_router/test/go_router_test.dart index d98f10711c5..80e170b7924 100644 --- a/packages/go_router/test/go_router_test.dart +++ b/packages/go_router/test/go_router_test.dart @@ -755,6 +755,7 @@ void main() { ), GoRoute( path: '/family/:fid', + caseSensitive: false, builder: (BuildContext context, GoRouterState state) => FamilyScreen(state.pathParameters['fid']!), ), @@ -780,6 +781,56 @@ void main() { expect(find.byType(FamilyScreen), findsOneWidget); }); + testWidgets('match path case sensitively', (WidgetTester tester) async { + final FlutterExceptionHandler? oldFlutterError = FlutterError.onError; + addTearDown(() => FlutterError.onError = oldFlutterError); + final List errors = []; + FlutterError.onError = (FlutterErrorDetails details) { + errors.add(details); + }; + final List routes = [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + ), + GoRoute( + path: '/family/:fid', + builder: (BuildContext context, GoRouterState state) => + FamilyScreen(state.pathParameters['fid']!), + ), + ]; + + final GoRouter router = await createRouter(routes, tester); + const String wrongLoc = '/FaMiLy/f2'; + + expect(errors, isEmpty); + router.go(wrongLoc); + await tester.pumpAndSettle(); + + expect(errors, hasLength(1)); + expect( + errors.single.exception, + isAssertionError, + reason: 'The path is case sensitive', + ); + + const String loc = '/family/f2'; + router.go(loc); + await tester.pumpAndSettle(); + final List matches = + router.routerDelegate.currentConfiguration.matches; + + expect( + router.routerDelegate.currentConfiguration.uri.toString(), + loc, + ); + + expect(matches, hasLength(1)); + expect(find.byType(FamilyScreen), findsOneWidget); + expect(errors, hasLength(1), reason: 'No new errors should be thrown'); + }); + testWidgets( 'If there is more than one route to match, use the first match.', (WidgetTester tester) async { diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index fba99c45dbf..5789f8aba38 100644 --- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md @@ -1,3 +1,7 @@ +## NEXT + +* Updates README to indicate that Andoid SDK <21 is no longer supported. + ## 2.12.1 * Fixes typo in README. diff --git a/packages/google_maps_flutter/google_maps_flutter/README.md b/packages/google_maps_flutter/google_maps_flutter/README.md index dd7bd70a337..53b2cceeb2d 100644 --- a/packages/google_maps_flutter/google_maps_flutter/README.md +++ b/packages/google_maps_flutter/google_maps_flutter/README.md @@ -8,7 +8,7 @@ A Flutter plugin that provides a [Google Maps](https://developers.google.com/map | | Android | iOS | Web | |-------------|---------|---------|----------------------------------| -| **Support** | SDK 20+ | iOS 14+ | Same as [Flutter's][web-support] | +| **Support** | SDK 21+ | iOS 14+ | Same as [Flutter's][web-support] | [web-support]: https://docs.flutter.dev/reference/supported-platforms diff --git a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md index aee6c12b2cf..6071bc8027f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.16.1 + +* Removes obsolete code related to supporting SDK <21. + ## 2.16.0 * Adds support for animating the camera with a duration. diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle b/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle index c86b55971b4..ffb540618d0 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle @@ -26,7 +26,7 @@ android { compileSdk = flutter.compileSdkVersion defaultConfig { - minSdkVersion 20 + minSdkVersion 21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ClusterManagersControllerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ClusterManagersControllerTest.java index df4208df5e6..a63efc17df1 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ClusterManagersControllerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ClusterManagersControllerTest.java @@ -16,7 +16,6 @@ import android.content.Context; import android.content.res.AssetManager; import android.graphics.Bitmap; -import android.os.Build; import androidx.test.core.app.ApplicationProvider; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.CameraPosition; @@ -41,10 +40,8 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; @RunWith(RobolectricTestRunner.class) -@Config(minSdk = Build.VERSION_CODES.LOLLIPOP) public class ClusterManagersControllerTest { private Context context; private MapsCallbackApi flutterApi; diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ConvertTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ConvertTest.java index 7590eb53d36..acb5fb85a9f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ConvertTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ConvertTest.java @@ -24,7 +24,6 @@ import static org.mockito.Mockito.when; import android.content.res.AssetManager; -import android.os.Build; import android.util.Base64; import androidx.annotation.NonNull; import com.google.android.gms.maps.model.BitmapDescriptor; @@ -49,10 +48,8 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; @RunWith(RobolectricTestRunner.class) -@Config(minSdk = Build.VERSION_CODES.LOLLIPOP) public class ConvertTest { @Mock private AssetManager assetManager; diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapControllerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapControllerTest.java index c03156e68c1..a5d23705990 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapControllerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapControllerTest.java @@ -18,7 +18,6 @@ import static org.mockito.Mockito.when; import android.content.Context; -import android.os.Build; import androidx.activity.ComponentActivity; import androidx.test.core.app.ApplicationProvider; import com.google.android.gms.maps.CameraUpdate; @@ -41,10 +40,8 @@ import org.mockito.MockitoAnnotations; import org.robolectric.Robolectric; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; @RunWith(RobolectricTestRunner.class) -@Config(minSdk = Build.VERSION_CODES.LOLLIPOP) public class GoogleMapControllerTest { private Context context; diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapInitializerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapInitializerTest.java index 302e48cb720..19672da8990 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapInitializerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapInitializerTest.java @@ -13,7 +13,6 @@ import static org.mockito.Mockito.verify; import android.content.Context; -import android.os.Build; import androidx.test.core.app.ApplicationProvider; import com.google.android.gms.maps.MapsInitializer.Renderer; import io.flutter.plugin.common.BinaryMessenger; @@ -23,10 +22,8 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; @RunWith(RobolectricTestRunner.class) -@Config(minSdk = Build.VERSION_CODES.LOLLIPOP) public class GoogleMapInitializerTest { private GoogleMapInitializer googleMapInitializer; diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GroundOverlaysControllerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GroundOverlaysControllerTest.java index d6ba8b0a76b..f359a5666ad 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GroundOverlaysControllerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GroundOverlaysControllerTest.java @@ -12,7 +12,6 @@ import android.content.Context; import android.content.res.AssetManager; -import android.os.Build; import android.util.Base64; import androidx.annotation.NonNull; import androidx.test.core.app.ApplicationProvider; @@ -31,10 +30,8 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; @RunWith(RobolectricTestRunner.class) -@Config(minSdk = Build.VERSION_CODES.LOLLIPOP) public class GroundOverlaysControllerTest { @Mock private BitmapDescriptorFactoryWrapper bitmapDescriptorFactoryWrapper; @Mock private BitmapDescriptor mockBitmapDescriptor; diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/HeatmapsControllerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/HeatmapsControllerTest.java index 59c4560f97d..e199e4be482 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/HeatmapsControllerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/HeatmapsControllerTest.java @@ -15,7 +15,6 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.when; -import android.os.Build; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.TileOverlay; import com.google.android.gms.maps.model.TileOverlayOptions; @@ -30,10 +29,8 @@ import org.junit.runner.RunWith; import org.mockito.Mockito; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; @RunWith(RobolectricTestRunner.class) -@Config(minSdk = Build.VERSION_CODES.LOLLIPOP) public class HeatmapsControllerTest { private HeatmapsController controller; private GoogleMap googleMap; diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/MarkersControllerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/MarkersControllerTest.java index 1540ebccf69..1a98c1141b1 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/MarkersControllerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/MarkersControllerTest.java @@ -15,7 +15,6 @@ import android.content.Context; import android.content.res.AssetManager; import android.graphics.Bitmap; -import android.os.Build; import androidx.test.core.app.ApplicationProvider; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.LatLng; @@ -36,10 +35,8 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; @RunWith(RobolectricTestRunner.class) -@Config(minSdk = Build.VERSION_CODES.LOLLIPOP) public class MarkersControllerTest { private Context context; private MapsCallbackApi flutterApi; diff --git a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml index ad3b86b3ad2..84779722eb1 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_android description: Android implementation of the google_maps_flutter plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.16.0 +version: 2.16.1 environment: sdk: ^3.6.0 diff --git a/packages/google_sign_in/google_sign_in/CHANGELOG.md b/packages/google_sign_in/google_sign_in/CHANGELOG.md index 17f98cbaa1d..124b689e716 100644 --- a/packages/google_sign_in/google_sign_in/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in/CHANGELOG.md @@ -1,3 +1,7 @@ +## NEXT + +* Updates README to indicate that Andoid SDK <21 is no longer supported. + ## 6.3.0 * Adds a sign-in field to allow Android clients to explicitly specify an account name. This diff --git a/packages/google_sign_in/google_sign_in/README.md b/packages/google_sign_in/google_sign_in/README.md index c5d7130ec8f..2bcac7b3768 100644 --- a/packages/google_sign_in/google_sign_in/README.md +++ b/packages/google_sign_in/google_sign_in/README.md @@ -4,7 +4,7 @@ A Flutter plugin for [Google Sign In](https://developers.google.com/identity/). | | Android | iOS | macOS | Web | |-------------|---------|-------|--------|-----| -| **Support** | SDK 16+ | 12.0+ | 10.15+ | Any | +| **Support** | SDK 21+ | 12.0+ | 10.15+ | Any | ## Platform integration diff --git a/packages/google_sign_in/google_sign_in_android/CHANGELOG.md b/packages/google_sign_in/google_sign_in_android/CHANGELOG.md index 97cc7f19158..3d66c7b33fc 100644 --- a/packages/google_sign_in/google_sign_in_android/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 6.2.1 + +* Removes obsolete code related to supporting SDK <21. + ## 6.2.0 * Adds a sign-in field to allow clients to explicitly specify an account name. diff --git a/packages/google_sign_in/google_sign_in_android/android/build.gradle b/packages/google_sign_in/google_sign_in_android/android/build.gradle index 472bf3e6914..9d6132be045 100644 --- a/packages/google_sign_in/google_sign_in_android/android/build.gradle +++ b/packages/google_sign_in/google_sign_in_android/android/build.gradle @@ -26,7 +26,7 @@ android { compileSdk = flutter.compileSdkVersion defaultConfig { - minSdkVersion 19 + minSdkVersion 21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/packages/google_sign_in/google_sign_in_android/example/android/build.gradle b/packages/google_sign_in/google_sign_in_android/example/android/build.gradle index 0b6e9f1672f..b812ba73567 100644 --- a/packages/google_sign_in/google_sign_in_android/example/android/build.gradle +++ b/packages/google_sign_in/google_sign_in_android/example/android/build.gradle @@ -30,7 +30,8 @@ tasks.register("clean", Delete) { gradle.projectsEvaluated { project(":google_sign_in_android") { tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" + // Ignore classfile due to https://issuetracker.google.com/issues/342067844 + options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" } } } diff --git a/packages/google_sign_in/google_sign_in_android/pubspec.yaml b/packages/google_sign_in/google_sign_in_android/pubspec.yaml index 2fa4e0bbe81..05197dda1f0 100644 --- a/packages/google_sign_in/google_sign_in_android/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_android/pubspec.yaml @@ -2,7 +2,7 @@ name: google_sign_in_android description: Android implementation of the google_sign_in plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 6.2.0 +version: 6.2.1 environment: sdk: ^3.6.0 diff --git a/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md b/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md index ccd7d19cfe5..ddcbd4044e0 100644 --- a/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.9.0 + +* Updates Google Sign-In SDK to 8.0+. + ## 5.8.1 * Asserts that new `forceAccountName` parameter is null (not used in iOS). diff --git a/packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios.podspec b/packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios.podspec index c846540e0ab..b6c8e728d9c 100644 --- a/packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios.podspec +++ b/packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios.podspec @@ -20,7 +20,7 @@ Enables Google Sign-In in Flutter apps. # Depend on versions which defines modules. s.dependency 'AppAuth', '>= 1.7.4' s.dependency 'GTMSessionFetcher', '>= 3.4.0' - s.dependency 'GoogleSignIn', '~> 7.1' + s.dependency 'GoogleSignIn', '~> 8.0' s.static_framework = true s.ios.dependency 'Flutter' s.osx.dependency 'FlutterMacOS' diff --git a/packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Package.swift b/packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Package.swift index 0a3a57cf5b4..f41e40ec679 100644 --- a/packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Package.swift +++ b/packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Package.swift @@ -18,7 +18,7 @@ let package = Package( dependencies: [ .package( url: "https://github.com/google/GoogleSignIn-iOS.git", - from: "7.1.0") + from: "8.0.0") ], targets: [ .target( diff --git a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml index 1a9dedf65d5..87f3cfffab8 100644 --- a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: google_sign_in_ios description: iOS implementation of the google_sign_in plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 5.8.1 +version: 5.9.0 environment: sdk: ^3.4.0 diff --git a/packages/image_picker/image_picker_android/CHANGELOG.md b/packages/image_picker/image_picker_android/CHANGELOG.md index 153fd125b1d..43cf01b1458 100644 --- a/packages/image_picker/image_picker_android/CHANGELOG.md +++ b/packages/image_picker/image_picker_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.12+23 + +* Removes obsolete code related to supporting SDK <21. + ## 0.8.12+22 * Updates compileSdk 34 to flutter.compileSdkVersion. diff --git a/packages/image_picker/image_picker_android/android/build.gradle b/packages/image_picker/image_picker_android/android/build.gradle index 7f0b608e55e..5b3dd5d3b84 100644 --- a/packages/image_picker/image_picker_android/android/build.gradle +++ b/packages/image_picker/image_picker_android/android/build.gradle @@ -26,7 +26,7 @@ android { compileSdk = flutter.compileSdkVersion defaultConfig { - minSdkVersion 19 + minSdkVersion 21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { diff --git a/packages/image_picker/image_picker_android/example/android/build.gradle b/packages/image_picker/image_picker_android/example/android/build.gradle index 74d56a2a791..f8a5b5f14eb 100755 --- a/packages/image_picker/image_picker_android/example/android/build.gradle +++ b/packages/image_picker/image_picker_android/example/android/build.gradle @@ -30,7 +30,8 @@ tasks.register("clean", Delete) { gradle.projectsEvaluated { project(":image_picker_android") { tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" + // Ignore classfile due to https://issuetracker.google.com/issues/342067844 + options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" } } } diff --git a/packages/image_picker/image_picker_android/pubspec.yaml b/packages/image_picker/image_picker_android/pubspec.yaml index 61ff88d4334..0132f199b53 100755 --- a/packages/image_picker/image_picker_android/pubspec.yaml +++ b/packages/image_picker/image_picker_android/pubspec.yaml @@ -2,7 +2,7 @@ name: image_picker_android description: Android implementation of the image_picker plugin. repository: https://github.com/flutter/packages/tree/main/packages/image_picker/image_picker_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22 -version: 0.8.12+22 +version: 0.8.12+23 environment: sdk: ^3.6.0 diff --git a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md index 5fd20a12223..02d883c551d 100644 --- a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md @@ -1,3 +1,7 @@ +## NEXT + +* Updates README to indicate that Andoid SDK <21 is no longer supported. + ## 3.2.1 * Updates minimum supported SDK version to Flutter 3.24/Dart 3.5. diff --git a/packages/in_app_purchase/in_app_purchase/README.md b/packages/in_app_purchase/in_app_purchase/README.md index 6340db25b31..1a10714154c 100644 --- a/packages/in_app_purchase/in_app_purchase/README.md +++ b/packages/in_app_purchase/in_app_purchase/README.md @@ -7,7 +7,7 @@ which can be the App Store (on iOS and macOS) or Google Play (on Android). | | Android | iOS | macOS | |-------------|---------|-------|--------| -| **Support** | SDK 16+ | 12.0+ | 10.15+ | +| **Support** | SDK 21+ | 12.0+ | 10.15+ |

) -> Void) { + Task { + guard let currentStorefront = await Storefront.current else { + let error = PigeonError( + code: "storekit2_failed_to_fetch_country_code", + message: "Storekit has failed to fetch the country code.", + details: "Storefront.current returned nil.") + completion(.failure(error)) + return + } + completion(.success(currentStorefront.countryCode)) + return + } + } + + /// Wrapper method around StoreKit2's sync() method + /// https://developer.apple.com/documentation/storekit/appstore/sync() + /// When called, a system prompt will ask users to enter their authentication details + func sync(completion: @escaping (Result) -> Void) { + Task { + do { + try await AppStore.sync() + completion(.success(())) + return + } catch { + let pigeonError = PigeonError( + code: "storekit2_failed_to_sync_to_app_store", + message: "Storekit has failed to sync to the app store.", + details: "\(error)") + completion(.failure(pigeonError)) + return + } + } + } + /// This Task listens to Transation.updates as shown here /// https://developer.apple.com/documentation/storekit/transaction/3851206-updates /// This function should be called as soon as the app starts to avoid missing any Transactions done outside of the app. diff --git a/packages/in_app_purchase/in_app_purchase_storekit/darwin/in_app_purchase_storekit/Sources/in_app_purchase_storekit/StoreKit2/sk2_pigeon.g.swift b/packages/in_app_purchase/in_app_purchase_storekit/darwin/in_app_purchase_storekit/Sources/in_app_purchase_storekit/StoreKit2/sk2_pigeon.g.swift index 25c848efda2..e53c62bba06 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/darwin/in_app_purchase_storekit/Sources/in_app_purchase_storekit/StoreKit2/sk2_pigeon.g.swift +++ b/packages/in_app_purchase/in_app_purchase_storekit/darwin/in_app_purchase_storekit/Sources/in_app_purchase_storekit/StoreKit2/sk2_pigeon.g.swift @@ -1,7 +1,7 @@ // 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 (v22.7.3), do not edit directly. +// Autogenerated from Pigeon (v25.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -18,9 +18,9 @@ import Foundation final class PigeonError: Error { let code: String let message: String? - let details: Any? + let details: Sendable? - init(code: String, message: String?, details: Any?) { + init(code: String, message: String?, details: Sendable?) { self.code = code self.message = message self.details = details @@ -521,6 +521,8 @@ protocol InAppPurchase2API { func startListeningToTransactions() throws func stopListeningToTransactions() throws func restorePurchases(completion: @escaping (Result) -> Void) + func countryCode(completion: @escaping (Result) -> Void) + func sync(completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -676,6 +678,41 @@ class InAppPurchase2APISetup { } else { restorePurchasesChannel.setMessageHandler(nil) } + let countryCodeChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.in_app_purchase_storekit.InAppPurchase2API.countryCode\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + countryCodeChannel.setMessageHandler { _, reply in + api.countryCode { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + countryCodeChannel.setMessageHandler(nil) + } + let syncChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.in_app_purchase_storekit.InAppPurchase2API.sync\(channelSuffix)", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + syncChannel.setMessageHandler { _, reply in + api.sync { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + syncChannel.setMessageHandler(nil) + } } } /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. @@ -713,7 +750,7 @@ class InAppPurchase2CallbackAPI: InAppPurchase2CallbackAPIProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart index 51787d9c642..6272dcd583e 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart @@ -241,6 +241,9 @@ class InAppPurchaseStoreKitPlatform extends InAppPurchasePlatform { /// See: https://developer.apple.com/documentation/storekit/skstorefront?language=objc @override Future countryCode() async { + if (_useStoreKit2) { + return Storefront().countryCode(); + } return (await _skPaymentQueueWrapper.storefront())?.countryCode ?? ''; } diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform_addition.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform_addition.dart index 3b88aacc16e..447f41f0a18 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform_addition.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform_addition.dart @@ -3,16 +3,25 @@ // found in the LICENSE file. import 'package:in_app_purchase_platform_interface/in_app_purchase_platform_interface.dart'; -import '../in_app_purchase_storekit.dart'; +import '../in_app_purchase_storekit.dart'; +import '../store_kit_2_wrappers.dart'; import '../store_kit_wrappers.dart'; /// Contains InApp Purchase features that are only available on iOS. class InAppPurchaseStoreKitPlatformAddition extends InAppPurchasePlatformAddition { + /// Synchronizes your app’s transaction information and subscription status + /// with information from the App Store. + /// Storekit 2 only + Future sync() { + return AppStore().sync(); + } + /// Present Code Redemption Sheet. /// /// Available on devices running iOS 14 and iPadOS 14 and later. + /// Available for StoreKit 1 and 2 Future presentCodeRedemptionSheet() { return SKPaymentQueueWrapper().presentCodeRedemptionSheet(); } diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/sk2_pigeon.g.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/sk2_pigeon.g.dart index 749c50f9fff..a27af1af409 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/sk2_pigeon.g.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/sk2_pigeon.g.dart @@ -1,7 +1,7 @@ // 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 (v22.7.3), do not edit directly. +// Autogenerated from Pigeon (v25.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -29,6 +29,22 @@ List wrapResponse( return [error.code, error.message, error.details]; } +bool _deepEquals(Object? a, Object? b) { + if (a is List && b is List) { + return a.length == b.length && + a.indexed + .every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1])); + } + if (a is Map && b is Map) { + final Iterable keys = (a as Map).keys; + return a.length == b.length && + keys.every((Object? key) => + (b as Map).containsKey(key) && + _deepEquals(a[key], b[key])); + } + return a == b; +} + enum SK2ProductTypeMessage { /// A consumable in-app purchase. consumable, @@ -89,7 +105,7 @@ class SK2SubscriptionOfferMessage { SK2SubscriptionOfferPaymentModeMessage paymentMode; - Object encode() { + List _toList() { return [ id, price, @@ -100,6 +116,10 @@ class SK2SubscriptionOfferMessage { ]; } + Object encode() { + return _toList(); + } + static SK2SubscriptionOfferMessage decode(Object result) { result as List; return SK2SubscriptionOfferMessage( @@ -111,6 +131,28 @@ class SK2SubscriptionOfferMessage { paymentMode: result[5]! as SK2SubscriptionOfferPaymentModeMessage, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! SK2SubscriptionOfferMessage || + other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return id == other.id && + price == other.price && + type == other.type && + period == other.period && + periodCount == other.periodCount && + paymentMode == other.paymentMode; + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); } class SK2SubscriptionPeriodMessage { @@ -125,13 +167,17 @@ class SK2SubscriptionPeriodMessage { /// The unit of time that this period represents. SK2SubscriptionPeriodUnitMessage unit; - Object encode() { + List _toList() { return [ value, unit, ]; } + Object encode() { + return _toList(); + } + static SK2SubscriptionPeriodMessage decode(Object result) { result as List; return SK2SubscriptionPeriodMessage( @@ -139,6 +185,23 @@ class SK2SubscriptionPeriodMessage { unit: result[1]! as SK2SubscriptionPeriodUnitMessage, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! SK2SubscriptionPeriodMessage || + other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return value == other.value && unit == other.unit; + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); } class SK2SubscriptionInfoMessage { @@ -157,7 +220,7 @@ class SK2SubscriptionInfoMessage { /// The duration that this subscription lasts before auto-renewing. SK2SubscriptionPeriodMessage subscriptionPeriod; - Object encode() { + List _toList() { return [ promotionalOffers, subscriptionGroupID, @@ -165,6 +228,10 @@ class SK2SubscriptionInfoMessage { ]; } + Object encode() { + return _toList(); + } + static SK2SubscriptionInfoMessage decode(Object result) { result as List; return SK2SubscriptionInfoMessage( @@ -174,6 +241,25 @@ class SK2SubscriptionInfoMessage { subscriptionPeriod: result[2]! as SK2SubscriptionPeriodMessage, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! SK2SubscriptionInfoMessage || + other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(promotionalOffers, other.promotionalOffers) && + subscriptionGroupID == other.subscriptionGroupID && + subscriptionPeriod == other.subscriptionPeriod; + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); } /// A Pigeon message class representing a Product @@ -214,7 +300,7 @@ class SK2ProductMessage { /// The currency and locale information for this product SK2PriceLocaleMessage priceLocale; - Object encode() { + List _toList() { return [ id, displayName, @@ -227,6 +313,10 @@ class SK2ProductMessage { ]; } + Object encode() { + return _toList(); + } + static SK2ProductMessage decode(Object result) { result as List; return SK2ProductMessage( @@ -240,6 +330,29 @@ class SK2ProductMessage { priceLocale: result[7]! as SK2PriceLocaleMessage, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! SK2ProductMessage || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return id == other.id && + displayName == other.displayName && + description == other.description && + price == other.price && + displayPrice == other.displayPrice && + type == other.type && + subscription == other.subscription && + priceLocale == other.priceLocale; + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); } class SK2PriceLocaleMessage { @@ -252,13 +365,17 @@ class SK2PriceLocaleMessage { String currencySymbol; - Object encode() { + List _toList() { return [ currencyCode, currencySymbol, ]; } + Object encode() { + return _toList(); + } + static SK2PriceLocaleMessage decode(Object result) { result as List; return SK2PriceLocaleMessage( @@ -266,6 +383,23 @@ class SK2PriceLocaleMessage { currencySymbol: result[1]! as String, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! SK2PriceLocaleMessage || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return currencyCode == other.currencyCode && + currencySymbol == other.currencySymbol; + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); } class SK2ProductPurchaseOptionsMessage { @@ -278,13 +412,17 @@ class SK2ProductPurchaseOptionsMessage { int? quantity; - Object encode() { + List _toList() { return [ appAccountToken, quantity, ]; } + Object encode() { + return _toList(); + } + static SK2ProductPurchaseOptionsMessage decode(Object result) { result as List; return SK2ProductPurchaseOptionsMessage( @@ -292,6 +430,24 @@ class SK2ProductPurchaseOptionsMessage { quantity: result[1] as int?, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! SK2ProductPurchaseOptionsMessage || + other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return appAccountToken == other.appAccountToken && + quantity == other.quantity; + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); } class SK2TransactionMessage { @@ -331,7 +487,7 @@ class SK2TransactionMessage { String? jsonRepresentation; - Object encode() { + List _toList() { return [ id, originalId, @@ -347,6 +503,10 @@ class SK2TransactionMessage { ]; } + Object encode() { + return _toList(); + } + static SK2TransactionMessage decode(Object result) { result as List; return SK2TransactionMessage( @@ -363,6 +523,32 @@ class SK2TransactionMessage { jsonRepresentation: result[10] as String?, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! SK2TransactionMessage || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return id == other.id && + originalId == other.originalId && + productId == other.productId && + purchaseDate == other.purchaseDate && + expirationDate == other.expirationDate && + purchasedQuantity == other.purchasedQuantity && + appAccountToken == other.appAccountToken && + restoring == other.restoring && + receiptData == other.receiptData && + error == other.error && + jsonRepresentation == other.jsonRepresentation; + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); } class SK2ErrorMessage { @@ -378,7 +564,7 @@ class SK2ErrorMessage { Map? userInfo; - Object encode() { + List _toList() { return [ code, domain, @@ -386,6 +572,10 @@ class SK2ErrorMessage { ]; } + Object encode() { + return _toList(); + } + static SK2ErrorMessage decode(Object result) { result as List; return SK2ErrorMessage( @@ -394,6 +584,24 @@ class SK2ErrorMessage { userInfo: (result[2] as Map?)?.cast(), ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! SK2ErrorMessage || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return code == other.code && + domain == other.domain && + _deepEquals(userInfo, other.userInfo); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); } class _PigeonCodec extends StandardMessageCodec { @@ -519,8 +727,9 @@ class InAppPurchase2API { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -548,8 +757,10 @@ class InAppPurchase2API { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([identifiers]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([identifiers]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -579,8 +790,10 @@ class InAppPurchase2API { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([id, options]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([id, options]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -608,8 +821,9 @@ class InAppPurchase2API { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -638,8 +852,10 @@ class InAppPurchase2API { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([id]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([id]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -662,8 +878,9 @@ class InAppPurchase2API { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -686,8 +903,9 @@ class InAppPurchase2API { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -710,8 +928,64 @@ class InAppPurchase2API { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + Future countryCode() async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_storekit.InAppPurchase2API.countryCode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else if (pigeonVar_replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (pigeonVar_replyList[0] as String?)!; + } + } + + Future sync() async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_storekit.InAppPurchase2API.sync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/store_kit_2_wrappers/sk2_appstore_wrapper.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/store_kit_2_wrappers/sk2_appstore_wrapper.dart index a57ad561126..fc8ef570e5c 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/store_kit_2_wrappers/sk2_appstore_wrapper.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/store_kit_2_wrappers/sk2_appstore_wrapper.dart @@ -11,8 +11,16 @@ InAppPurchase2API _hostApi = InAppPurchase2API(); final class AppStore { /// Dart wrapper for StoreKit2's canMakePayments() /// Returns a bool that indicates whether the person can make purchases. - /// (https://developer.apple.com/documentation/storekit/appstore/3822277-canmakepayments) + /// https://developer.apple.com/documentation/storekit/appstore/3822277-canmakepayments Future canMakePayments() { return _hostApi.canMakePayments(); } + + /// Dart wrapper for StoreKit2's sync() + /// Synchronizes your app’s transaction information and subscription status with information from the App Store. + /// Will initiate an authentication pop up. + /// https://developer.apple.com/documentation/storekit/appstore/sync() + Future sync() { + return _hostApi.sync(); + } } diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/store_kit_2_wrappers/sk2_storefront_wrapper.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/store_kit_2_wrappers/sk2_storefront_wrapper.dart new file mode 100644 index 00000000000..4d7ebcfa9bd --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/store_kit_2_wrappers/sk2_storefront_wrapper.dart @@ -0,0 +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. + +import '../../store_kit_2_wrappers.dart'; + +InAppPurchase2API _hostApi = InAppPurchase2API(); + +/// Wrapper for StoreKit2's Storefront +/// (https://developer.apple.com/documentation/storekit/storefront) +final class Storefront { + /// Dart wrapper for StoreKit2's countryCode() + /// Returns the 3 letter code for a store's locale + /// (https://developer.apple.com/documentation/storekit/storefront/countrycode) + Future countryCode() async { + return _hostApi.countryCode(); + } +} diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/store_kit_2_wrappers.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/store_kit_2_wrappers.dart index 05482180b1a..c34c24a7c1a 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/lib/store_kit_2_wrappers.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/store_kit_2_wrappers.dart @@ -5,4 +5,5 @@ export 'src/sk2_pigeon.g.dart'; export 'src/store_kit_2_wrappers/sk2_appstore_wrapper.dart'; export 'src/store_kit_2_wrappers/sk2_product_wrapper.dart'; +export 'src/store_kit_2_wrappers/sk2_storefront_wrapper.dart'; export 'src/store_kit_2_wrappers/sk2_transaction_wrapper.dart'; diff --git a/packages/in_app_purchase/in_app_purchase_storekit/pigeons/sk2_pigeon.dart b/packages/in_app_purchase/in_app_purchase_storekit/pigeons/sk2_pigeon.dart index cfb92b57b92..da57a65ee6e 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/pigeons/sk2_pigeon.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/pigeons/sk2_pigeon.dart @@ -199,6 +199,12 @@ abstract class InAppPurchase2API { @async void restorePurchases(); + + @async + String countryCode(); + + @async + void sync(); } @FlutterApi() diff --git a/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml index c6d973ce1f0..447f9077d11 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml @@ -2,7 +2,7 @@ name: in_app_purchase_storekit description: An implementation for the iOS and macOS platforms of the Flutter `in_app_purchase` plugin. This uses the StoreKit Framework. repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_storekit issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 0.3.21 +version: 0.3.22 environment: sdk: ^3.4.0 @@ -31,7 +31,7 @@ dev_dependencies: flutter_test: sdk: flutter json_serializable: ^6.0.0 - pigeon: ^22.4.2 + pigeon: ^25.1.0 test: ^1.16.0 topics: diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart index 15ea45f2a42..bf8773e8bd9 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart @@ -394,6 +394,16 @@ class FakeStoreKit2Platform implements TestInAppPurchase2Api { InAppPurchaseStoreKitPlatform.sk2TransactionObserver .onTransactionsUpdated(transactionList); } + + @override + Future countryCode() async { + return 'ABC'; + } + + @override + Future sync() { + return Future.value(); + } } SK2TransactionMessage createPendingTransaction(String id, {int quantity = 1}) { diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_2_platform_test.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_2_platform_test.dart index 658932e7ce6..d9a40562f59 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_2_platform_test.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_2_platform_test.dart @@ -192,4 +192,12 @@ void main() { } }); }); + + group('billing configuration', () { + test('country_code', () async { + const String expectedCountryCode = 'ABC'; + final String countryCode = await iapStoreKitPlatform.countryCode(); + expect(countryCode, expectedCountryCode); + }); + }); } diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/sk2_test_api.g.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/sk2_test_api.g.dart index 3a51df7105e..57399529e55 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/sk2_test_api.g.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/sk2_test_api.g.dart @@ -1,7 +1,7 @@ // 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 (v22.7.3), do not edit directly. +// Autogenerated from Pigeon (v25.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import, no_leading_underscores_for_local_identifiers // ignore_for_file: avoid_relative_lib_imports @@ -134,6 +134,10 @@ abstract class TestInAppPurchase2Api { Future restorePurchases(); + Future countryCode(); + + Future sync(); + static void setUp( TestInAppPurchase2Api? api, { BinaryMessenger? binaryMessenger, @@ -372,5 +376,57 @@ abstract class TestInAppPurchase2Api { }); } } + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.in_app_purchase_storekit.InAppPurchase2API.countryCode$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, + (Object? message) async { + try { + final String output = await api.countryCode(); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.in_app_purchase_storekit.InAppPurchase2API.sync$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(pigeonVar_channel, + (Object? message) async { + try { + await api.sync(); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } } } diff --git a/packages/local_auth/local_auth/CHANGELOG.md b/packages/local_auth/local_auth/CHANGELOG.md index 262015eb5e9..75b5912fef3 100644 --- a/packages/local_auth/local_auth/CHANGELOG.md +++ b/packages/local_auth/local_auth/CHANGELOG.md @@ -1,5 +1,6 @@ ## NEXT +* Updates README to indicate that Andoid SDK <21 is no longer supported. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 2.3.0 diff --git a/packages/local_auth/local_auth/README.md b/packages/local_auth/local_auth/README.md index 1fff94350f5..17c71a7aaf0 100644 --- a/packages/local_auth/local_auth/README.md +++ b/packages/local_auth/local_auth/README.md @@ -10,7 +10,7 @@ fingerprint or facial recognition. | | Android | iOS | macOS | Windows | |-------------|-----------|-------|--------|-------------| -| **Support** | SDK 16+\* | 12.0+ | 10.14+ | Windows 10+ | +| **Support** | SDK 21+\* | 12.0+ | 10.14+ | Windows 10+ | ## Usage @@ -200,7 +200,7 @@ app has not been updated to use Face ID. ## Android Integration -\* The plugin will build and run on SDK 16+, but `isDeviceSupported()` will +\* The plugin will build and run on SDK 21+, but `isDeviceSupported()` will always return false before SDK 23 (Android 6.0). ### Activity Changes diff --git a/packages/local_auth/local_auth_android/CHANGELOG.md b/packages/local_auth/local_auth_android/CHANGELOG.md index 8cdd60a339c..5474e5fea64 100644 --- a/packages/local_auth/local_auth_android/CHANGELOG.md +++ b/packages/local_auth/local_auth_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.49 + +* Removes obsolete code related to supporting SDK <21. + ## 1.0.48 * Updates compileSdk 34 to flutter.compileSdkVersion. diff --git a/packages/local_auth/local_auth_android/android/build.gradle b/packages/local_auth/local_auth_android/android/build.gradle index fee1e85091b..cc143f2ee5c 100644 --- a/packages/local_auth/local_auth_android/android/build.gradle +++ b/packages/local_auth/local_auth_android/android/build.gradle @@ -26,7 +26,7 @@ android { compileSdk = flutter.compileSdkVersion defaultConfig { - minSdkVersion 19 + minSdkVersion 21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/packages/local_auth/local_auth_android/example/android/build.gradle b/packages/local_auth/local_auth_android/example/android/build.gradle index 5eee7f5e4fb..485e7242a07 100644 --- a/packages/local_auth/local_auth_android/example/android/build.gradle +++ b/packages/local_auth/local_auth_android/example/android/build.gradle @@ -30,7 +30,8 @@ tasks.register("clean", Delete) { gradle.projectsEvaluated { project(":local_auth_android") { tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" + // Ignore classfile due to https://issuetracker.google.com/issues/342067844 + options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" } } } diff --git a/packages/local_auth/local_auth_android/pubspec.yaml b/packages/local_auth/local_auth_android/pubspec.yaml index 0c7e8c09165..12600aa7617 100644 --- a/packages/local_auth/local_auth_android/pubspec.yaml +++ b/packages/local_auth/local_auth_android/pubspec.yaml @@ -2,7 +2,7 @@ name: local_auth_android description: Android implementation of the local_auth plugin. repository: https://github.com/flutter/packages/tree/main/packages/local_auth/local_auth_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+local_auth%22 -version: 1.0.48 +version: 1.0.49 environment: sdk: ^3.6.0 diff --git a/packages/path_provider/path_provider/CHANGELOG.md b/packages/path_provider/path_provider/CHANGELOG.md index 1c8d48672e4..54d4069a8b0 100644 --- a/packages/path_provider/path_provider/CHANGELOG.md +++ b/packages/path_provider/path_provider/CHANGELOG.md @@ -1,5 +1,6 @@ ## NEXT +* Updates README to indicate that Andoid SDK <21 is no longer supported. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 2.1.5 diff --git a/packages/path_provider/path_provider/README.md b/packages/path_provider/path_provider/README.md index 3ff47ab52ea..8390d5d9968 100644 --- a/packages/path_provider/path_provider/README.md +++ b/packages/path_provider/path_provider/README.md @@ -9,7 +9,7 @@ Not all methods are supported on all platforms. | | Android | iOS | Linux | macOS | Windows | |-------------|---------|-------|-------|--------|-------------| -| **Support** | SDK 16+ | 12.0+ | Any | 10.14+ | Windows 10+ | +| **Support** | SDK 21+ | 12.0+ | Any | 10.14+ | Windows 10+ | ## Example diff --git a/packages/path_provider/path_provider_android/CHANGELOG.md b/packages/path_provider/path_provider_android/CHANGELOG.md index ee42d762463..91d224331a2 100644 --- a/packages/path_provider/path_provider_android/CHANGELOG.md +++ b/packages/path_provider/path_provider_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.2.17 + +* Removes obsolete code related to supporting SDK <21. + ## 2.2.16 * Updates compileSdk 34 to flutter.compileSdkVersion. diff --git a/packages/path_provider/path_provider_android/android/build.gradle b/packages/path_provider/path_provider_android/android/build.gradle index 014be4b1995..53381b0ebb4 100644 --- a/packages/path_provider/path_provider_android/android/build.gradle +++ b/packages/path_provider/path_provider_android/android/build.gradle @@ -26,7 +26,7 @@ android { compileSdk = flutter.compileSdkVersion defaultConfig { - minSdkVersion 19 + minSdkVersion 21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { diff --git a/packages/path_provider/path_provider_android/example/android/build.gradle b/packages/path_provider/path_provider_android/example/android/build.gradle index b1a5e0b9707..e073a0d1780 100644 --- a/packages/path_provider/path_provider_android/example/android/build.gradle +++ b/packages/path_provider/path_provider_android/example/android/build.gradle @@ -30,7 +30,8 @@ tasks.register("clean", Delete) { gradle.projectsEvaluated { project(":path_provider_android") { tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" + // Ignore classfile due to https://issuetracker.google.com/issues/342067844 + options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" } } } diff --git a/packages/path_provider/path_provider_android/pubspec.yaml b/packages/path_provider/path_provider_android/pubspec.yaml index 237783bbe6f..fe5ccc56f41 100644 --- a/packages/path_provider/path_provider_android/pubspec.yaml +++ b/packages/path_provider/path_provider_android/pubspec.yaml @@ -2,7 +2,7 @@ name: path_provider_android description: Android implementation of the path_provider plugin. repository: https://github.com/flutter/packages/tree/main/packages/path_provider/path_provider_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22 -version: 2.2.16 +version: 2.2.17 environment: sdk: ^3.6.0 diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md index be111f4d502..97e4971a17c 100644 --- a/packages/pigeon/CHANGELOG.md +++ b/packages/pigeon/CHANGELOG.md @@ -1,3 +1,8 @@ +## 25.3.1 + +* [kotlin] Fixes Kotlin InstanceManager not properly removing callbacks from handler. +* [kotlin] Fixes `SyntheticAccessor` lint caused by private utility methods. + ## 25.3.0 * [swift] Adds equality methods to generated data classes. diff --git a/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/EventChannelMessages.g.kt b/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/EventChannelMessages.g.kt index 3bc2680f888..c9aee7c4299 100644 --- a/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/EventChannelMessages.g.kt +++ b/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/EventChannelMessages.g.kt @@ -12,33 +12,32 @@ import io.flutter.plugin.common.StandardMethodCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer -private fun deepEqualsEventChannelMessages(a: Any?, b: Any?): Boolean { - if (a is ByteArray && b is ByteArray) { - return a.contentEquals(b) - } - if (a is IntArray && b is IntArray) { - return a.contentEquals(b) - } - if (a is LongArray && b is LongArray) { - return a.contentEquals(b) - } - if (a is DoubleArray && b is DoubleArray) { - return a.contentEquals(b) - } - if (a is Array<*> && b is Array<*>) { - return a.size == b.size && a.indices.all { deepEqualsEventChannelMessages(a[it], b[it]) } - } - if (a is List<*> && b is List<*>) { - return a.size == b.size && a.indices.all { deepEqualsEventChannelMessages(a[it], b[it]) } - } - if (a is Map<*, *> && b is Map<*, *>) { - return a.size == b.size && - a.all { - (b as Map).containsKey(it.key) && - deepEqualsEventChannelMessages(it.value, b[it.key]) - } +private object EventChannelMessagesPigeonUtils { + fun deepEquals(a: Any?, b: Any?): Boolean { + if (a is ByteArray && b is ByteArray) { + return a.contentEquals(b) + } + if (a is IntArray && b is IntArray) { + return a.contentEquals(b) + } + if (a is LongArray && b is LongArray) { + return a.contentEquals(b) + } + if (a is DoubleArray && b is DoubleArray) { + return a.contentEquals(b) + } + if (a is Array<*> && b is Array<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is List<*> && b is List<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is Map<*, *> && b is Map<*, *>) { + return a.size == b.size && + a.all { (b as Map).containsKey(it.key) && deepEquals(it.value, b[it.key]) } + } + return a == b } - return a == b } /** @@ -68,7 +67,7 @@ data class IntEvent(val data: Long) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelMessages(toList(), other.toList()) + return EventChannelMessagesPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -96,7 +95,7 @@ data class StringEvent(val data: String) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelMessages(toList(), other.toList()) + return EventChannelMessagesPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() diff --git a/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt b/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt index 82a8666b6ba..589faae8be2 100644 --- a/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt +++ b/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt @@ -13,24 +13,53 @@ import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer -private fun wrapResult(result: Any?): List { - return listOf(result) -} +private object MessagesPigeonUtils { -private fun wrapError(exception: Throwable): List { - return if (exception is FlutterError) { - listOf(exception.code, exception.message, exception.details) - } else { - listOf( - exception.javaClass.simpleName, - exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + fun createConnectionError(channelName: String): FlutterError { + return FlutterError( + "channel-error", "Unable to establish connection on channel: '$channelName'.", "") + } + + fun wrapResult(result: Any?): List { + return listOf(result) + } + + fun wrapError(exception: Throwable): List { + return if (exception is FlutterError) { + listOf(exception.code, exception.message, exception.details) + } else { + listOf( + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + } } -} -private fun createConnectionError(channelName: String): FlutterError { - return FlutterError( - "channel-error", "Unable to establish connection on channel: '$channelName'.", "") + fun deepEquals(a: Any?, b: Any?): Boolean { + if (a is ByteArray && b is ByteArray) { + return a.contentEquals(b) + } + if (a is IntArray && b is IntArray) { + return a.contentEquals(b) + } + if (a is LongArray && b is LongArray) { + return a.contentEquals(b) + } + if (a is DoubleArray && b is DoubleArray) { + return a.contentEquals(b) + } + if (a is Array<*> && b is Array<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is List<*> && b is List<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is Map<*, *> && b is Map<*, *>) { + return a.size == b.size && + a.all { (b as Map).containsKey(it.key) && deepEquals(it.value, b[it.key]) } + } + return a == b + } } /** @@ -46,34 +75,6 @@ class FlutterError( val details: Any? = null ) : Throwable() -private fun deepEqualsMessages(a: Any?, b: Any?): Boolean { - if (a is ByteArray && b is ByteArray) { - return a.contentEquals(b) - } - if (a is IntArray && b is IntArray) { - return a.contentEquals(b) - } - if (a is LongArray && b is LongArray) { - return a.contentEquals(b) - } - if (a is DoubleArray && b is DoubleArray) { - return a.contentEquals(b) - } - if (a is Array<*> && b is Array<*>) { - return a.size == b.size && a.indices.all { deepEqualsMessages(a[it], b[it]) } - } - if (a is List<*> && b is List<*>) { - return a.size == b.size && a.indices.all { deepEqualsMessages(a[it], b[it]) } - } - if (a is Map<*, *> && b is Map<*, *>) { - return a.size == b.size && - a.all { - (b as Map).containsKey(it.key) && deepEqualsMessages(it.value, b[it.key]) - } - } - return a == b -} - enum class Code(val raw: Int) { ONE(0), TWO(1); @@ -118,7 +119,7 @@ data class MessageData( if (this === other) { return true } - return deepEqualsMessages(toList(), other.toList()) + return MessagesPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -184,7 +185,7 @@ interface ExampleHostApi { try { listOf(api.getHostLanguage()) } catch (exception: Throwable) { - wrapError(exception) + MessagesPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -207,7 +208,7 @@ interface ExampleHostApi { try { listOf(api.add(aArg, bArg)) } catch (exception: Throwable) { - wrapError(exception) + MessagesPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -228,10 +229,10 @@ interface ExampleHostApi { api.sendMessage(messageArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(MessagesPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(MessagesPigeonUtils.wrapResult(data)) } } } @@ -274,7 +275,7 @@ class MessageFlutterApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) } } } diff --git a/packages/pigeon/lib/src/generator_tools.dart b/packages/pigeon/lib/src/generator_tools.dart index f2350155461..529d9a712d1 100644 --- a/packages/pigeon/lib/src/generator_tools.dart +++ b/packages/pigeon/lib/src/generator_tools.dart @@ -15,7 +15,7 @@ import 'generator.dart'; /// The current version of pigeon. /// /// This must match the version in pubspec.yaml. -const String pigeonVersion = '25.3.0'; +const String pigeonVersion = '25.3.1'; /// Read all the content from [stdin] to a String. String readStdin() { diff --git a/packages/pigeon/lib/src/kotlin/kotlin_generator.dart b/packages/pigeon/lib/src/kotlin/kotlin_generator.dart index c539afad5cf..bd2719d92d4 100644 --- a/packages/pigeon/lib/src/kotlin/kotlin_generator.dart +++ b/packages/pigeon/lib/src/kotlin/kotlin_generator.dart @@ -28,7 +28,7 @@ const DocumentCommentSpecification _docCommentSpec = blockContinuationToken: _docCommentContinuation, ); -String _codecName = 'PigeonCodec'; +const String _codecName = 'PigeonCodec'; /// Name of field used for host API codec. const String _pigeonMethodChannelCodec = 'PigeonMethodCodec'; @@ -317,7 +317,7 @@ class KotlinGenerator extends StructuredGenerator { indent.writeln('return true'); }); indent.write( - 'return deepEquals${generatorOptions.fileSpecificClassNameComponent}(toList(), other.toList())'); + 'return ${_getUtilsClassName(generatorOptions)}.deepEquals(toList(), other.toList())'); }); indent.newln(); @@ -655,6 +655,7 @@ if (wrapped == null) { dartPackageName: dartPackageName, onWriteBody: ( Indent indent, { + required InternalKotlinOptions generatorOptions, required List parameters, required TypeDeclaration returnType, required String channelName, @@ -665,6 +666,7 @@ if (wrapped == null) { ); _writeFlutterMethodMessageCall( indent, + generatorOptions: generatorOptions, parameters: parameters, returnType: returnType, channelName: '$channelName\$separatedMessageChannelSuffix', @@ -741,6 +743,7 @@ if (wrapped == null) { for (final Method method in api.methods) { _writeHostMethodMessageHandler( indent, + generatorOptions: generatorOptions, name: method.name, channelName: '${makeChannelName(api, method, dartPackageName)}\$separatedMessageChannelSuffix', @@ -823,6 +826,7 @@ if (wrapped == null) { const String setHandlerCondition = 'instanceManager != null'; _writeHostMethodMessageHandler( indent, + generatorOptions: generatorOptions, name: 'removeStrongReference', channelName: makeRemoveStrongReferenceChannelName(dartPackageName), @@ -847,6 +851,7 @@ if (wrapped == null) { ); _writeHostMethodMessageHandler( indent, + generatorOptions: generatorOptions, name: 'clear', channelName: makeClearChannelName(dartPackageName), taskQueueType: TaskQueueType.serial, @@ -1188,7 +1193,7 @@ if (wrapped == null) { void _writeWrapResult(Indent indent) { indent.newln(); - indent.write('private fun wrapResult(result: Any?): List '); + indent.write('fun wrapResult(result: Any?): List '); indent.addScoped('{', '}', () { indent.writeln('return listOf(result)'); }); @@ -1196,7 +1201,7 @@ if (wrapped == null) { void _writeWrapError(InternalKotlinOptions generatorOptions, Indent indent) { indent.newln(); - indent.write('private fun wrapError(exception: Throwable): List '); + indent.write('fun wrapError(exception: Throwable): List '); indent.addScoped('{', '}', () { indent.write( 'return if (exception is ${_getErrorClassName(generatorOptions)}) '); @@ -1242,7 +1247,7 @@ if (wrapped == null) { final String errorClassName = _getErrorClassName(generatorOptions); indent.newln(); indent.write( - 'private fun createConnectionError(channelName: String): $errorClassName '); + 'fun createConnectionError(channelName: String): $errorClassName '); indent.addScoped('{', '}', () { indent.write( 'return $errorClassName("channel-error", "Unable to establish connection on channel: \'\$channelName\'.", "")'); @@ -1251,7 +1256,7 @@ if (wrapped == null) { void _writeDeepEquals(InternalKotlinOptions generatorOptions, Indent indent) { indent.format(''' -private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any?, b: Any?): Boolean { +fun deepEquals(a: Any?, b: Any?): Boolean { if (a is ByteArray && b is ByteArray) { return a.contentEquals(b) } @@ -1266,16 +1271,16 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? } if (a is Array<*> && b is Array<*>) { return a.size == b.size && - a.indices.all{ deepEquals${generatorOptions.fileSpecificClassNameComponent}(a[it], b[it]) } + a.indices.all{ deepEquals(a[it], b[it]) } } if (a is List<*> && b is List<*>) { return a.size == b.size && - a.indices.all{ deepEquals${generatorOptions.fileSpecificClassNameComponent}(a[it], b[it]) } + a.indices.all{ deepEquals(a[it], b[it]) } } if (a is Map<*, *> && b is Map<*, *>) { return a.size == b.size && a.all { (b as Map).containsKey(it.key) && - deepEquals${generatorOptions.fileSpecificClassNameComponent}(it.value, b[it.key]) + deepEquals(it.value, b[it.key]) } } return a == b @@ -1290,19 +1295,26 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? Indent indent, { required String dartPackageName, }) { - if (root.containsHostApi || root.containsProxyApi) { - _writeWrapResult(indent); - _writeWrapError(generatorOptions, indent); - } - if (root.containsFlutterApi || root.containsProxyApi) { - _writeCreateConnectionError(generatorOptions, indent); - } + indent.writeScoped( + 'private object ${_getUtilsClassName(generatorOptions)} {', + '}', + () { + if (root.containsFlutterApi || root.containsProxyApi) { + _writeCreateConnectionError(generatorOptions, indent); + } + if (root.containsHostApi || root.containsProxyApi) { + _writeWrapResult(indent); + _writeWrapError(generatorOptions, indent); + } + if (root.classes.isNotEmpty) { + _writeDeepEquals(generatorOptions, indent); + } + }, + ); + if (generatorOptions.includeErrorClass) { _writeErrorClass(generatorOptions, indent); } - if (root.classes.isNotEmpty) { - _writeDeepEquals(generatorOptions, indent); - } } static void _writeMethodDeclaration( @@ -1367,6 +1379,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? void _writeHostMethodMessageHandler( Indent indent, { + required InternalKotlinOptions generatorOptions, required String name, required String channelName, required TaskQueueType taskQueueType, @@ -1419,14 +1432,17 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? indent.addScoped('{ result: Result<$resultType> ->', '}', () { indent.writeln('val error = result.exceptionOrNull()'); indent.writeScoped('if (error != null) {', '}', () { - indent.writeln('reply.reply(wrapError(error))'); + indent.writeln( + 'reply.reply(${_getUtilsClassName(generatorOptions)}.wrapError(error))'); }, addTrailingNewline: false); indent.addScoped(' else {', '}', () { if (returnType.isVoid) { - indent.writeln('reply.reply(wrapResult(null))'); + indent.writeln( + 'reply.reply(${_getUtilsClassName(generatorOptions)}.wrapResult(null))'); } else { indent.writeln('val data = result.getOrNull()'); - indent.writeln('reply.reply(wrapResult(data))'); + indent.writeln( + 'reply.reply(${_getUtilsClassName(generatorOptions)}.wrapResult(data))'); } }); }); @@ -1441,7 +1457,8 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? }, addTrailingNewline: false); indent.add(' catch (exception: Throwable) '); indent.addScoped('{', '}', () { - indent.writeln('wrapError(exception)'); + indent.writeln( + '${_getUtilsClassName(generatorOptions)}.wrapError(exception)'); }); indent.writeln('reply.reply(wrapped)'); } @@ -1465,6 +1482,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? int? minApiRequirement, void Function( Indent indent, { + required InternalKotlinOptions generatorOptions, required List parameters, required TypeDeclaration returnType, required String channelName, @@ -1486,6 +1504,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? indent.addScoped('{', '}', () { onWriteBody( indent, + generatorOptions: generatorOptions, parameters: parameters, returnType: returnType, channelName: channelName, @@ -1496,6 +1515,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? static void _writeFlutterMethodMessageCall( Indent indent, { + required InternalKotlinOptions generatorOptions, required List parameters, required TypeDeclaration returnType, required String channelName, @@ -1542,7 +1562,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? }, addTrailingNewline: false); indent.addScoped('else {', '} ', () { indent.writeln( - 'callback(Result.failure(createConnectionError(channelName)))'); + 'callback(Result.failure(${_getUtilsClassName(generatorOptions)}.createConnectionError(channelName)))'); }); }); } @@ -1839,7 +1859,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? ) if (api != null) { channel.setMessageHandler { _, reply -> - reply.reply(wrapError(UnsupportedOperationException( + reply.reply(${_getUtilsClassName(generatorOptions)}.wrapError(UnsupportedOperationException( "Call references class `$className`, which requires api version $apiRequirement." ))) } @@ -1872,6 +1892,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? onWrite: () { _writeHostMethodMessageHandler( indent, + generatorOptions: generatorOptions, name: name, channelName: channelName, taskQueueType: TaskQueueType.serial, @@ -1916,6 +1937,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? onWrite: () { _writeHostMethodMessageHandler( indent, + generatorOptions: generatorOptions, name: field.name, channelName: channelName, taskQueueType: TaskQueueType.serial, @@ -1961,6 +1983,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? onWrite: () { _writeHostMethodMessageHandler( indent, + generatorOptions: generatorOptions, name: method.name, channelName: makeChannelName(api, method, dartPackageName), taskQueueType: method.taskQueueType, @@ -2026,6 +2049,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? ], onWriteBody: ( Indent indent, { + required InternalKotlinOptions generatorOptions, required List parameters, required TypeDeclaration returnType, required String channelName, @@ -2069,6 +2093,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? indent.writeln('val codec = pigeonRegistrar.codec'); _writeFlutterMethodMessageCall( indent, + generatorOptions: generatorOptions, returnType: returnType, channelName: channelName, errorClassName: errorClassName, @@ -2136,6 +2161,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? ], onWriteBody: ( Indent indent, { + required InternalKotlinOptions generatorOptions, required List parameters, required TypeDeclaration returnType, required String channelName, @@ -2159,6 +2185,7 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? indent.writeln('val codec = pigeonRegistrar.codec'); _writeFlutterMethodMessageCall( indent, + generatorOptions: generatorOptions, returnType: returnType, channelName: channelName, errorClassName: errorClassName, @@ -2214,6 +2241,14 @@ private fun deepEquals${generatorOptions.fileSpecificClassNameComponent}(a: Any? String _getErrorClassName(InternalKotlinOptions generatorOptions) => generatorOptions.errorClassName ?? 'FlutterError'; +/// Calculates the name of the private utils class that will be generated for +/// the file. +String _getUtilsClassName(InternalKotlinOptions options) { + return toUpperCamelCase( + '${options.fileSpecificClassNameComponent ?? ''}PigeonUtils', + ); +} + String _getArgumentName(int count, NamedType argument) => argument.name.isEmpty ? 'arg$count' : argument.name; diff --git a/packages/pigeon/lib/src/kotlin/templates.dart b/packages/pigeon/lib/src/kotlin/templates.dart index af9f4b357ea..652a0f683af 100644 --- a/packages/pigeon/lib/src/kotlin/templates.dart +++ b/packages/pigeon/lib/src/kotlin/templates.dart @@ -48,6 +48,9 @@ class ${kotlinInstanceManagerClassName(options)}(private val finalizationListene private val referenceQueue = java.lang.ref.ReferenceQueue() private val weakReferencesToIdentifiers = HashMap, Long>() private val handler = android.os.Handler(android.os.Looper.getMainLooper()) + private val releaseAllFinalizedInstancesRunnable = Runnable { + this.releaseAllFinalizedInstances() + } private var nextIdentifier: Long = minHostCreatedIdentifier private var hasFinalizationListenerStopped = false @@ -57,16 +60,13 @@ class ${kotlinInstanceManagerClassName(options)}(private val finalizationListene */ var clearFinalizedWeakReferencesInterval: Long = 3000 set(value) { - handler.removeCallbacks { this.releaseAllFinalizedInstances() } + handler.removeCallbacks(releaseAllFinalizedInstancesRunnable) field = value releaseAllFinalizedInstances() } init { - handler.postDelayed( - { releaseAllFinalizedInstances() }, - clearFinalizedWeakReferencesInterval - ) + handler.postDelayed(releaseAllFinalizedInstancesRunnable, clearFinalizedWeakReferencesInterval) } companion object { @@ -136,7 +136,9 @@ class ${kotlinInstanceManagerClassName(options)}(private val finalizationListene /** * Adds a new unique instance that was instantiated from the host platform. * - * [identifier] must be >= 0 and unique. + * If the manager contains [instance], this returns the corresponding identifier. If the + * manager does not contain [instance], this adds the instance and returns a unique + * identifier for that [instance]. */ fun addHostCreatedInstance(instance: Any): Long { logWarningIfFinalizationListenerHasStopped() @@ -167,7 +169,7 @@ class ${kotlinInstanceManagerClassName(options)}(private val finalizationListene * longer be called and methods will log a warning. */ fun stopFinalizationListener() { - handler.removeCallbacks { this.releaseAllFinalizedInstances() } + handler.removeCallbacks(releaseAllFinalizedInstancesRunnable) hasFinalizationListenerStopped = true } @@ -206,10 +208,7 @@ class ${kotlinInstanceManagerClassName(options)}(private val finalizationListene finalizationListener.onFinalize(identifier) } } - handler.postDelayed( - { releaseAllFinalizedInstances() }, - clearFinalizedWeakReferencesInterval - ) + handler.postDelayed(releaseAllFinalizedInstancesRunnable, clearFinalizedWeakReferencesInterval) } private fun addInstance(instance: Any, identifier: Long) { diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle index 53ebf4e31da..f71a743c5d8 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle @@ -31,7 +31,7 @@ android { } defaultConfig { - minSdkVersion 19 + minSdkVersion 21 } testOptions { diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/.gitignore b/packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/.gitignore similarity index 100% rename from packages/pigeon/platform_tests/alternate_language_test_plugin/ios/.gitignore rename to packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/.gitignore diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/alternate_language_test_plugin.podspec b/packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin.podspec similarity index 68% rename from packages/pigeon/platform_tests/alternate_language_test_plugin/ios/alternate_language_test_plugin.podspec rename to packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin.podspec index 5ca6da69e3a..45bbd5350de 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/alternate_language_test_plugin.podspec +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin.podspec @@ -13,15 +13,16 @@ A plugin to test Pigeon generation for secondary languages (e.g., Java, Objectiv s.license = { :type => 'BSD', :file => '../../../LICENSE' } s.author = { 'Your Company' => 'email@example.com' } s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/pigeon' } - s.source_files = 'Classes/**/*' - s.public_header_files = 'Classes/**/*.h' - s.dependency 'Flutter' - s.platform = :ios, '12.0' + s.source_files = 'alternate_language_test_plugin/Sources/alternate_language_test_plugin/**/*.{h,m}' + s.public_header_files = 'alternate_language_test_plugin/Sources/alternate_language_test_plugin/include/**/*.h' + s.ios.dependency 'Flutter' + s.osx.dependency 'FlutterMacOS' + s.ios.deployment_target = '12.0' + s.osx.deployment_target = '10.14' s.xcconfig = { 'LIBRARY_SEARCH_PATHS' => '$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)/ $(SDKROOT)/usr/lib/swift', 'LD_RUNPATH_SEARCH_PATHS' => '/usr/lib/swift', } - - # Flutter.framework does not contain a i386 slice. - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } + s.swift_version = '5.0' end diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Package.swift b/packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Package.swift new file mode 100644 index 00000000000..6d0fb8ffa56 --- /dev/null +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Package.swift @@ -0,0 +1,30 @@ +// swift-tools-version: 5.9 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +// 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. + +import PackageDescription + +let package = Package( + name: "alternate_language_test_plugin", + platforms: [ + .iOS("12.0"), + .macOS("10.14"), + ], + products: [ + .library(name: "alternate-language-test-plugin", targets: ["alternate_language_test_plugin"]) + ], + dependencies: [], + targets: [ + .target( + name: "alternate_language_test_plugin", + dependencies: [], + resources: [], + cSettings: [ + .headerSearchPath("include/alternate_language_test_plugin") + ] + ) + ] +) diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/.gitignore b/packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Sources/alternate_language_test_plugin/.gitignore similarity index 51% rename from packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/.gitignore rename to packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Sources/alternate_language_test_plugin/.gitignore index 55a15533a3f..3edd8a721ec 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/.gitignore +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Sources/alternate_language_test_plugin/.gitignore @@ -1,4 +1,4 @@ -# TODO(stuartmorgan): Remove this once more of the files that macOS doesn't +# TODO(stuartmorgan): Remove this once more of the files that iOS/macOS don't # use have been eliminated via test consolidation. *.gen.h *.gen.m diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/AlternateLanguageTestPlugin.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Sources/alternate_language_test_plugin/AlternateLanguageTestPlugin.m similarity index 100% rename from packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/AlternateLanguageTestPlugin.m rename to packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Sources/alternate_language_test_plugin/AlternateLanguageTestPlugin.m diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Sources/alternate_language_test_plugin/CoreTests.gen.m similarity index 99% rename from packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m rename to packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Sources/alternate_language_test_plugin/CoreTests.gen.m index 36fb0a516f5..65d9c336d64 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.m +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Sources/alternate_language_test_plugin/CoreTests.gen.m @@ -5,7 +5,7 @@ // Autogenerated from Pigeon, do not edit directly. // See also: https://pub.dev/packages/pigeon -#import "CoreTests.gen.h" +#import "./include/alternate_language_test_plugin/CoreTests.gen.h" #if TARGET_OS_OSX #import diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/AlternateLanguageTestPlugin.h b/packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Sources/alternate_language_test_plugin/include/alternate_language_test_plugin/AlternateLanguageTestPlugin.h similarity index 90% rename from packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/AlternateLanguageTestPlugin.h rename to packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Sources/alternate_language_test_plugin/include/alternate_language_test_plugin/AlternateLanguageTestPlugin.h index 104ee200c11..e3d6932e113 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/AlternateLanguageTestPlugin.h +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Sources/alternate_language_test_plugin/include/alternate_language_test_plugin/AlternateLanguageTestPlugin.h @@ -2,7 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#if TARGET_OS_OSX #import +#else +#import +#endif #import "CoreTests.gen.h" diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h b/packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Sources/alternate_language_test_plugin/include/alternate_language_test_plugin/CoreTests.gen.h similarity index 100% rename from packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/CoreTests.gen.h rename to packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Sources/alternate_language_test_plugin/include/alternate_language_test_plugin/CoreTests.gen.h diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/.gitignore b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/.gitignore index 24476c5d1eb..6c319542b34 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/.gitignore +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/.gitignore @@ -5,9 +5,11 @@ *.swp .DS_Store .atom/ +.build/ .buildlog/ .history .svn/ +.swiftpm/ migrate_working_dir/ # IntelliJ related diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Runner.xcodeproj/project.pbxproj b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Runner.xcodeproj/project.pbxproj index d922c88e3d4..25d767028d4 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Runner.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; EB2133B34553CD36D4AE374F /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F87F49FAD891F66A75D95E85 /* libPods-Runner.a */; }; + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -109,6 +110,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, EB2133B34553CD36D4AE374F /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -240,6 +242,9 @@ productType = "com.apple.product-type.bundle.unit-test"; }; 97C146ED1CF9000F007C117D /* Runner */ = { + packageProductDependencies = ( + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, + ); isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( @@ -264,6 +269,9 @@ /* Begin PBXProject section */ 97C146E61CF9000F007C117D /* Project object */ = { + packageReferences = ( + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */, + ); isa = PBXProject; attributes = { LastUpgradeCheck = 1510; @@ -745,6 +753,18 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ +/* Begin XCLocalSwiftPackageReference section */ + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; + }; +/* End XCLocalSwiftPackageReference section */ +/* Begin XCSwiftPackageProductDependency section */ + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { + isa = XCSwiftPackageProductDependency; + productName = FlutterGeneratedPluginSwiftPackage; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; } diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index d19488d45ea..17337d64b42 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -5,6 +5,24 @@ + + + + + + + + + + diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner.xcodeproj/project.pbxproj b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner.xcodeproj/project.pbxproj index 27dfc3decfb..4a79415c598 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -103,6 +104,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, 0D7AA04F867B850C58216739 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -240,7 +242,6 @@ 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, - 271CA0FEC73C4F272B016320 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -248,6 +249,9 @@ 33CC11202044C79F0003C045 /* PBXTargetDependency */, ); name = Runner; + packageProductDependencies = ( + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, + ); productName = Runner; productReference = 33CC10ED2044A3C60003C045 /* alternate_language_test_plugin_example.app */; productType = "com.apple.product-type.application"; @@ -259,7 +263,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 331C80D4294CF70F00263BE5 = { @@ -291,6 +295,9 @@ Base, ); mainGroup = 33CC10E42044A3C60003C045; + packageReferences = ( + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */, + ); productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; projectDirPath = ""; projectRoot = ""; @@ -322,23 +329,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 271CA0FEC73C4F272B016320 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -786,6 +776,20 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCLocalSwiftPackageReference section */ + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { + isa = XCSwiftPackageProductDependency; + productName = FlutterGeneratedPluginSwiftPackage; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 33CC10E52044A3C60003C045 /* Project object */; } diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index fbd9258fad0..a574a8a2591 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,10 +1,28 @@ + + + + + + + + + + diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner/AppDelegate.swift b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner/AppDelegate.swift index 5cec4c48f62..21fbd0297b2 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner/AppDelegate.swift +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner/AppDelegate.swift @@ -5,9 +5,13 @@ import Cocoa import FlutterMacOS -@NSApplicationMain +@main class AppDelegate: FlutterAppDelegate { override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { return true } + + override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { + return true + } } diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Assets/.gitkeep b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Assets/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/.gitignore b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/.gitignore deleted file mode 100644 index a00d32beecc..00000000000 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -# TODO(stuartmorgan): Remove this, so that review will show the effects of -# changes on generated files. This will need a way to avoid unnecessary churn, -# such as a flag to suppress version stamp generation. -*.gen.h -*.gen.m -!CoreTests.gen.* \ No newline at end of file diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/AlternateLanguageTestPlugin.h b/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/AlternateLanguageTestPlugin.h deleted file mode 100644 index de949488ae5..00000000000 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/ios/Classes/AlternateLanguageTestPlugin.h +++ /dev/null @@ -1,15 +0,0 @@ -// 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. - -#import - -#import "CoreTests.gen.h" - -@interface AlternateLanguageTestPlugin : NSObject -@end - -@interface AlternateLanguageTestAPIWithSuffix : NSObject -+ (void)registerWithRegistrar:(NSObject *)registrar - suffix:(NSString *)suffix; -@end diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/AlternateLanguageTestPlugin.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/AlternateLanguageTestPlugin.m deleted file mode 100644 index 4f2b9d69450..00000000000 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/AlternateLanguageTestPlugin.m +++ /dev/null @@ -1,1170 +0,0 @@ -// 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. - -#import "AlternateLanguageTestPlugin.h" - -#import "CoreTests.gen.h" - -@interface AlternateLanguageTestPlugin () -@property(nonatomic) FLTFlutterSmallApi *flutterSmallApiOne; -@property(nonatomic) FLTFlutterSmallApi *flutterSmallApiTwo; -@property(nonatomic) FLTFlutterIntegrationCoreApi *flutterAPI; -@end - -/// This plugin handles the native side of the integration tests in example/integration_test/. -@implementation AlternateLanguageTestPlugin -+ (void)registerWithRegistrar:(NSObject *)registrar { - AlternateLanguageTestPlugin *plugin = [[AlternateLanguageTestPlugin alloc] init]; - SetUpFLTHostIntegrationCoreApi([registrar messenger], plugin); - [AlternateLanguageTestAPIWithSuffix registerWithRegistrar:registrar suffix:@"suffixOne"]; - [AlternateLanguageTestAPIWithSuffix registerWithRegistrar:registrar suffix:@"suffixTwo"]; - plugin.flutterAPI = - [[FLTFlutterIntegrationCoreApi alloc] initWithBinaryMessenger:[registrar messenger]]; - plugin.flutterSmallApiOne = - [[FLTFlutterSmallApi alloc] initWithBinaryMessenger:[registrar messenger] - messageChannelSuffix:@"suffixOne"]; - plugin.flutterSmallApiTwo = - [[FLTFlutterSmallApi alloc] initWithBinaryMessenger:[registrar messenger] - messageChannelSuffix:@"suffixTwo"]; -} - -#pragma mark HostIntegrationCoreApi implementation - -- (void)noopWithError:(FlutterError *_Nullable *_Nonnull)error { -} - -- (nullable FLTAllTypes *)echoAllTypes:(FLTAllTypes *)everything - error:(FlutterError *_Nullable *_Nonnull)error { - return everything; -} - -- (nullable FLTAllNullableTypes *)echoAllNullableTypes:(nullable FLTAllNullableTypes *)everything - error:(FlutterError *_Nullable *_Nonnull)error { - return everything; -} - -- (nullable FLTAllNullableTypesWithoutRecursion *) - echoAllNullableTypesWithoutRecursion:(nullable FLTAllNullableTypesWithoutRecursion *)everything - error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - return everything; -} - -- (nullable id)throwErrorWithError:(FlutterError *_Nullable *_Nonnull)error { - *error = [FlutterError errorWithCode:@"An error" message:nil details:nil]; - return nil; -} - -- (void)throwErrorFromVoidWithError:(FlutterError *_Nullable *_Nonnull)error { - *error = [FlutterError errorWithCode:@"An error" message:nil details:nil]; -} - -- (nullable id)throwFlutterErrorWithError:(FlutterError *_Nullable *_Nonnull)error { - *error = [FlutterError errorWithCode:@"code" message:@"message" details:@"details"]; - return nil; -} - -- (nullable NSNumber *)echoInt:(NSInteger)anInt error:(FlutterError *_Nullable *_Nonnull)error { - return @(anInt); -} - -- (nullable NSNumber *)echoDouble:(double)aDouble error:(FlutterError *_Nullable *_Nonnull)error { - return @(aDouble); -} - -- (nullable NSNumber *)echoBool:(BOOL)aBool error:(FlutterError *_Nullable *_Nonnull)error { - return @(aBool); -} - -- (nullable NSString *)echoString:(NSString *)aString - error:(FlutterError *_Nullable *_Nonnull)error { - return aString; -} - -- (nullable FlutterStandardTypedData *)echoUint8List:(FlutterStandardTypedData *)aUint8List - error:(FlutterError *_Nullable *_Nonnull)error { - return aUint8List; -} - -- (nullable id)echoObject:(id)anObject error:(FlutterError *_Nullable *_Nonnull)error { - return anObject; -} - -- (nullable NSArray *)echoList:(NSArray *)list - error:(FlutterError *_Nullable *_Nonnull)error { - return list; -} - -- (nullable NSArray *)echoEnumList:(NSArray *)enumList - error:(FlutterError *_Nullable *_Nonnull)error { - return enumList; -} - -- (nullable NSArray *) - echoClassList:(NSArray *)classList - error:(FlutterError *_Nullable *_Nonnull)error { - return classList; -} - -- (nullable NSArray *) - echoNonNullEnumList:(nonnull NSArray *)enumList - error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - return enumList; -} - -- (nullable NSArray *) - echoNonNullClassList:(nonnull NSArray *)classList - error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - return classList; -} - -- (nullable NSDictionary *)echoMap:(NSDictionary *)map - error:(FlutterError *_Nullable *_Nonnull)error { - return map; -} - -- (nullable NSDictionary *) - echoStringMap:(NSDictionary *)stringMap - error:(FlutterError *_Nullable *_Nonnull)error { - return stringMap; -} - -- (nullable NSDictionary *) - echoIntMap:(NSDictionary *)intMap - error:(FlutterError *_Nullable *_Nonnull)error { - return intMap; -} - -- (nullable NSDictionary *) - echoEnumMap:(NSDictionary *)enumMap - error:(FlutterError *_Nullable *_Nonnull)error { - return enumMap; -} - -- (nullable NSDictionary *) - echoClassMap:(NSDictionary *)classMap - error:(FlutterError *_Nullable *_Nonnull)error { - return classMap; -} - -- (nullable NSDictionary *) - echoNonNullStringMap:(nonnull NSDictionary *)stringMap - error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - return stringMap; -} - -- (nullable NSDictionary *) - echoNonNullIntMap:(nonnull NSDictionary *)intMap - error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - return intMap; -} - -- (nullable NSDictionary *) - echoNonNullEnumMap:(nonnull NSDictionary *)enumMap - error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - return enumMap; -} - -- (nullable NSDictionary *) - echoNonNullClassMap:(nonnull NSDictionary *)classMap - error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - return classMap; -} - -- (nullable FLTAllClassesWrapper *)echoClassWrapper:(FLTAllClassesWrapper *)wrapper - error:(FlutterError *_Nullable *_Nonnull)error { - return wrapper; -} - -- (FLTAnEnumBox *_Nullable)echoEnum:(FLTAnEnum)anEnum - error:(FlutterError *_Nullable *_Nonnull)error { - return [[FLTAnEnumBox alloc] initWithValue:anEnum]; -} - -- (FLTAnotherEnumBox *_Nullable)echoAnotherEnum:(FLTAnotherEnum)anotherEnum - error:(FlutterError *_Nullable *_Nonnull)error { - return [[FLTAnotherEnumBox alloc] initWithValue:anotherEnum]; -} - -- (nullable NSString *)echoNamedDefaultString:(NSString *)aString - error:(FlutterError *_Nullable *_Nonnull)error { - return aString; -} - -- (nullable NSNumber *)echoOptionalDefaultDouble:(double)aDouble - error:(FlutterError *_Nullable *_Nonnull)error { - return @(aDouble); -} - -- (nullable NSNumber *)echoRequiredInt:(NSInteger)anInt - error:(FlutterError *_Nullable *_Nonnull)error { - return @(anInt); -} - -- (nullable NSString *)extractNestedNullableStringFrom:(FLTAllClassesWrapper *)wrapper - error:(FlutterError *_Nullable *_Nonnull)error { - return wrapper.allNullableTypes.aNullableString; -} - -- (nullable FLTAllClassesWrapper *) - createNestedObjectWithNullableString:(nullable NSString *)nullableString - error:(FlutterError *_Nullable *_Nonnull)error { - FLTAllNullableTypes *innerObject = [[FLTAllNullableTypes alloc] init]; - innerObject.aNullableString = nullableString; - return [FLTAllClassesWrapper makeWithAllNullableTypes:innerObject - allNullableTypesWithoutRecursion:nil - allTypes:nil - classList:@[] - nullableClassList:nil - classMap:@{} - nullableClassMap:nil]; -} - -- (nullable FLTAllNullableTypes *) - sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool - anInt:(nullable NSNumber *)aNullableInt - aString:(nullable NSString *)aNullableString - error:(FlutterError *_Nullable *_Nonnull)error { - FLTAllNullableTypes *someTypes = [[FLTAllNullableTypes alloc] init]; - someTypes.aNullableBool = aNullableBool; - someTypes.aNullableInt = aNullableInt; - someTypes.aNullableString = aNullableString; - return someTypes; -} - -- (nullable FLTAllNullableTypesWithoutRecursion *) - sendMultipleNullableTypesWithoutRecursionABool:(nullable NSNumber *)aNullableBool - anInt:(nullable NSNumber *)aNullableInt - aString:(nullable NSString *)aNullableString - error: - (FlutterError *_Nullable __autoreleasing *_Nonnull) - error { - FLTAllNullableTypesWithoutRecursion *someTypes = - [[FLTAllNullableTypesWithoutRecursion alloc] init]; - someTypes.aNullableBool = aNullableBool; - someTypes.aNullableInt = aNullableInt; - someTypes.aNullableString = aNullableString; - return someTypes; -} - -- (nullable NSNumber *)echoNullableInt:(nullable NSNumber *)aNullableInt - error:(FlutterError *_Nullable *_Nonnull)error { - return aNullableInt; -} - -- (nullable NSNumber *)echoNullableDouble:(nullable NSNumber *)aNullableDouble - error:(FlutterError *_Nullable *_Nonnull)error { - return aNullableDouble; -} - -- (nullable NSNumber *)echoNullableBool:(nullable NSNumber *)aNullableBool - error:(FlutterError *_Nullable *_Nonnull)error { - return aNullableBool; -} - -- (nullable NSString *)echoNullableString:(nullable NSString *)aNullableString - error:(FlutterError *_Nullable *_Nonnull)error { - return aNullableString; -} - -- (nullable FlutterStandardTypedData *) - echoNullableUint8List:(nullable FlutterStandardTypedData *)aNullableUint8List - error:(FlutterError *_Nullable *_Nonnull)error { - return aNullableUint8List; -} - -- (nullable id)echoNullableObject:(nullable id)aNullableObject - error:(FlutterError *_Nullable *_Nonnull)error { - return aNullableObject; -} - -- (nullable NSArray *)echoNullableList:(nullable NSArray *)aNullableList - error:(FlutterError *_Nullable *_Nonnull)error { - return aNullableList; -} - -- (nullable NSArray *) - echoNullableEnumList:(nullable NSArray *)enumList - error:(FlutterError *_Nullable *_Nonnull)error { - return enumList; -} - -- (nullable NSArray *) - echoNullableClassList:(nullable NSArray *)classList - error:(FlutterError *_Nullable *_Nonnull)error { - return classList; -} - -- (nullable NSArray *) - echoNullableNonNullEnumList:(nullable NSArray *)enumList - error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - return enumList; -} - -- (nullable NSArray *) - echoNullableNonNullClassList:(nullable NSArray *)classList - error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - return classList; -} - -- (nullable NSDictionary *)echoNullableMap:(nullable NSDictionary *)map - error:(FlutterError *_Nullable *_Nonnull)error { - return map; -} - -- (nullable NSDictionary *) - echoNullableStringMap:(nullable NSDictionary *)stringMap - error:(FlutterError *_Nullable *_Nonnull)error { - return stringMap; -} - -- (nullable NSDictionary *) - echoNullableIntMap:(nullable NSDictionary *)intMap - error:(FlutterError *_Nullable *_Nonnull)error { - return intMap; -} - -- (nullable NSDictionary *) - echoNullableEnumMap:(nullable NSDictionary *)enumMap - error:(FlutterError *_Nullable *_Nonnull)error { - return enumMap; -} - -- (nullable NSDictionary *) - echoNullableClassMap:(nullable NSDictionary *)classMap - error:(FlutterError *_Nullable *_Nonnull)error { - return classMap; -} - -- (nullable NSDictionary *) - echoNullableNonNullStringMap:(nullable NSDictionary *)stringMap - error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - return stringMap; -} - -- (nullable NSDictionary *) - echoNullableNonNullIntMap:(nullable NSDictionary *)intMap - error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - return intMap; -} - -- (nullable NSDictionary *) - echoNullableNonNullEnumMap:(nullable NSDictionary *)enumMap - error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - return enumMap; -} - -- (nullable NSDictionary *) - echoNullableNonNullClassMap:(nullable NSDictionary *)classMap - error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - return classMap; -} - -- (FLTAnEnumBox *_Nullable)echoNullableEnum:(nullable FLTAnEnumBox *)AnEnumBoxed - error:(FlutterError *_Nullable *_Nonnull)error { - return AnEnumBoxed; -} - -- (FLTAnotherEnumBox *_Nullable)echoAnotherNullableEnum: - (nullable FLTAnotherEnumBox *)AnotherEnumBoxed - error:(FlutterError *_Nullable *_Nonnull)error { - return AnotherEnumBoxed; -} - -- (nullable NSNumber *)echoOptionalNullableInt:(nullable NSNumber *)aNullableInt - error:(FlutterError *_Nullable *_Nonnull)error { - return aNullableInt; -} - -- (nullable NSString *)echoNamedNullableString:(nullable NSString *)aNullableString - error:(FlutterError *_Nullable *_Nonnull)error { - return aNullableString; -} - -- (void)noopAsyncWithCompletion:(void (^)(FlutterError *_Nullable))completion { - completion(nil); -} - -- (void)throwAsyncErrorWithCompletion:(void (^)(id _Nullable, FlutterError *_Nullable))completion { - completion(nil, [FlutterError errorWithCode:@"An error" message:nil details:nil]); -} - -- (void)throwAsyncErrorFromVoidWithCompletion:(void (^)(FlutterError *_Nullable))completion { - completion([FlutterError errorWithCode:@"An error" message:nil details:nil]); -} - -- (void)throwAsyncFlutterErrorWithCompletion:(void (^)(id _Nullable, - FlutterError *_Nullable))completion { - completion(nil, [FlutterError errorWithCode:@"code" message:@"message" details:@"details"]); -} - -- (void)echoAsyncAllTypes:(FLTAllTypes *)everything - completion:(void (^)(FLTAllTypes *_Nullable, FlutterError *_Nullable))completion { - completion(everything, nil); -} - -- (void)echoAsyncNullableAllNullableTypes:(nullable FLTAllNullableTypes *)everything - completion:(void (^)(FLTAllNullableTypes *_Nullable, - FlutterError *_Nullable))completion { - completion(everything, nil); -} - -- (void) - echoAsyncNullableAllNullableTypesWithoutRecursion: - (nullable FLTAllNullableTypesWithoutRecursion *)everything - completion: - (nonnull void (^)( - FLTAllNullableTypesWithoutRecursion *_Nullable, - FlutterError *_Nullable))completion { - completion(everything, nil); -} - -- (void)echoAsyncInt:(NSInteger)anInt - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - completion(@(anInt), nil); -} - -- (void)echoAsyncDouble:(double)aDouble - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - completion(@(aDouble), nil); -} - -- (void)echoAsyncBool:(BOOL)aBool - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - completion(@(aBool), nil); -} - -- (void)echoAsyncString:(NSString *)aString - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion { - completion(aString, nil); -} - -- (void)echoAsyncUint8List:(FlutterStandardTypedData *)aUint8List - completion:(void (^)(FlutterStandardTypedData *_Nullable, - FlutterError *_Nullable))completion { - completion(aUint8List, nil); -} - -- (void)echoAsyncObject:(id)anObject - completion:(void (^)(id _Nullable, FlutterError *_Nullable))completion { - completion(anObject, nil); -} - -- (void)echoAsyncList:(NSArray *)list - completion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion { - completion(list, nil); -} - -- (void)echoAsyncEnumList:(NSArray *)enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - completion(enumList, nil); -} - -- (void)echoAsyncClassList:(NSArray *)classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - completion(classList, nil); -} - -- (void)echoAsyncMap:(NSDictionary *)map - completion: - (void (^)(NSDictionary *_Nullable, FlutterError *_Nullable))completion { - completion(map, nil); -} - -- (void)echoAsyncStringMap:(NSDictionary *)stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - completion(stringMap, nil); -} - -- (void)echoAsyncIntMap:(NSDictionary *)intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - completion(intMap, nil); -} - -- (void)echoAsyncEnumMap:(NSDictionary *)enumMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - completion(enumMap, nil); -} - -- (void)echoAsyncClassMap:(NSDictionary *)classMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - completion(classMap, nil); -} - -- (void)echoAsyncEnum:(FLTAnEnum)anEnum - completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion { - completion([[FLTAnEnumBox alloc] initWithValue:anEnum], nil); -} - -- (void)echoAnotherAsyncEnum:(FLTAnotherEnum)anotherEnum - completion: - (void (^)(FLTAnotherEnumBox *_Nullable, FlutterError *_Nullable))completion { - completion([[FLTAnotherEnumBox alloc] initWithValue:anotherEnum], nil); -} - -- (void)echoAsyncNullableInt:(nullable NSNumber *)anInt - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - completion(anInt, nil); -} - -- (void)echoAsyncNullableDouble:(nullable NSNumber *)aDouble - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - completion(aDouble, nil); -} - -- (void)echoAsyncNullableBool:(nullable NSNumber *)aBool - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - completion(aBool, nil); -} - -- (void)echoAsyncNullableString:(nullable NSString *)aString - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion { - completion(aString, nil); -} - -- (void)echoAsyncNullableUint8List:(nullable FlutterStandardTypedData *)aUint8List - completion:(void (^)(FlutterStandardTypedData *_Nullable, - FlutterError *_Nullable))completion { - completion(aUint8List, nil); -} - -- (void)echoAsyncNullableObject:(nullable id)anObject - completion:(void (^)(id _Nullable, FlutterError *_Nullable))completion { - completion(anObject, nil); -} - -- (void)echoAsyncNullableList:(nullable NSArray *)list - completion: - (void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion { - completion(list, nil); -} - -- (void)echoAsyncNullableEnumList:(nullable NSArray *)enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - completion(enumList, nil); -} - -- (void)echoAsyncNullableClassList:(nullable NSArray *)classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - completion(classList, nil); -} - -- (void)echoAsyncNullableMap:(nullable NSDictionary *)map - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - completion(map, nil); -} - -- (void)echoAsyncNullableStringMap:(nullable NSDictionary *)stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - completion(stringMap, nil); -} - -- (void)echoAsyncNullableIntMap:(nullable NSDictionary *)intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - completion(intMap, nil); -} - -- (void)echoAsyncNullableEnumMap:(nullable NSDictionary *)enumMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - completion(enumMap, nil); -} - -- (void) - echoAsyncNullableClassMap:(nullable NSDictionary *)classMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - completion(classMap, nil); -} - -- (void)echoAsyncNullableEnum:(nullable FLTAnEnumBox *)AnEnumBoxed - completion: - (void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion { - completion(AnEnumBoxed, nil); -} - -- (void)echoAnotherAsyncNullableEnum:(nullable FLTAnotherEnumBox *)AnotherEnumBoxed - completion:(void (^)(FLTAnotherEnumBox *_Nullable, - FlutterError *_Nullable))completion { - completion(AnotherEnumBoxed, nil); -} - -- (nullable NSNumber *)defaultIsMainThreadWithError:(FlutterError *_Nullable *_Nonnull)error { - // Using boxing on an inline expression results in the Dart side receiving an int, so - // force the right type via numberWithBool. - return [NSNumber numberWithBool:NSThread.isMainThread]; -} - -- (nullable NSNumber *)taskQueueIsBackgroundThreadWithError: - (FlutterError *_Nullable *_Nonnull)error { - // Using boxing on an inline expression results in the Dart side receiving an int, so - // force the right type via numberWithBool. - return [NSNumber numberWithBool:!NSThread.isMainThread]; -} - -- (void)callFlutterNoopWithCompletion:(void (^)(FlutterError *_Nullable))completion { - [self.flutterAPI noopWithCompletion:^(FlutterError *error) { - completion(error); - }]; -} - -- (void)callFlutterThrowErrorWithCompletion:(void (^)(id _Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI throwErrorWithCompletion:^(id value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterThrowErrorFromVoidWithCompletion:(void (^)(FlutterError *_Nullable))completion { - [self.flutterAPI throwErrorFromVoidWithCompletion:^(FlutterError *error) { - completion(error); - }]; -} - -- (void)callFlutterEchoAllTypes:(FLTAllTypes *)everything - completion: - (void (^)(FLTAllTypes *_Nullable, FlutterError *_Nullable))completion { - [self.flutterAPI echoAllTypes:everything - completion:^(FLTAllTypes *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterSendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool - anInt:(nullable NSNumber *)aNullableInt - aString:(nullable NSString *)aNullableString - completion:(void (^)(FLTAllNullableTypes *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI - sendMultipleNullableTypesABool:aNullableBool - anInt:aNullableInt - aString:aNullableString - completion:^(FLTAllNullableTypes *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterSendMultipleNullableTypesWithoutRecursionABool:(nullable NSNumber *)aNullableBool - anInt:(nullable NSNumber *)aNullableInt - aString: - (nullable NSString *)aNullableString - completion: - (nonnull void (^)( - FLTAllNullableTypesWithoutRecursion - *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI - sendMultipleNullableTypesWithoutRecursionABool:aNullableBool - anInt:aNullableInt - aString:aNullableString - completion:^(FLTAllNullableTypesWithoutRecursion *value, - FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoBool:(BOOL)aBool - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - [self.flutterAPI echoBool:aBool - completion:^(NSNumber *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoInt:(NSInteger)anInt - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - [self.flutterAPI echoInt:anInt - completion:^(NSNumber *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoDouble:(double)aDouble - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - [self.flutterAPI echoDouble:aDouble - completion:^(NSNumber *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoString:(NSString *)aString - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion { - [self.flutterAPI echoString:aString - completion:^(NSString *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoUint8List:(FlutterStandardTypedData *)list - completion:(void (^)(FlutterStandardTypedData *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoUint8List:list - completion:^(FlutterStandardTypedData *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoList:(NSArray *)list - completion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion { - [self.flutterAPI echoList:list - completion:^(NSArray *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoEnumList:(NSArray *)enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoEnumList:enumList - completion:^(NSArray *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoClassList:(NSArray *)classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoClassList:classList - completion:^(NSArray *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNonNullEnumList:(nonnull NSArray *)enumList - completion:(nonnull void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoNonNullEnumList:enumList - completion:^(NSArray *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNonNullClassList:(nonnull NSArray *)classList - completion:(nonnull void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI - echoNonNullClassList:classList - completion:^(NSArray *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoMap:(NSDictionary *)map - completion: - (void (^)(NSDictionary *_Nullable, FlutterError *_Nullable))completion { - [self.flutterAPI echoMap:map - completion:^(NSDictionary *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoStringMap:(NSDictionary *)stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI - echoStringMap:stringMap - completion:^(NSDictionary *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoIntMap:(NSDictionary *)intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoIntMap:intMap - completion:^(NSDictionary *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoEnumMap:(NSDictionary *)enumMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI - echoEnumMap:enumMap - completion:^(NSDictionary *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoClassMap:(NSDictionary *)classMap - completion: - (void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI - echoClassMap:classMap - completion:^(NSDictionary *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNonNullStringMap:(nonnull NSDictionary *)stringMap - completion: - (nonnull void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI - echoNonNullStringMap:stringMap - completion:^(NSDictionary *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNonNullIntMap:(nonnull NSDictionary *)intMap - completion: - (nonnull void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI - echoNonNullIntMap:intMap - completion:^(NSDictionary *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNonNullEnumMap: - (nonnull NSDictionary *)enumMap - completion:(nonnull void (^)( - NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoNonNullEnumMap:enumMap - completion:^(NSDictionary *value, - FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNonNullClassMap: - (nonnull NSDictionary *)classMap - completion: - (nonnull void (^)( - NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoNonNullClassMap:classMap - completion:^(NSDictionary *value, - FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoEnum:(FLTAnEnum)anEnum - completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion { - [self.flutterAPI echoEnum:anEnum - completion:^(FLTAnEnumBox *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoAnotherEnum:(FLTAnotherEnum)anotherEnum - completion:(void (^)(FLTAnotherEnumBox *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoAnotherEnum:anotherEnum - completion:^(FLTAnotherEnumBox *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoAllNullableTypes:(nullable FLTAllNullableTypes *)everything - completion:(void (^)(FLTAllNullableTypes *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoAllNullableTypes:everything - completion:^(FLTAllNullableTypes *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoAllNullableTypesWithoutRecursion: - (nullable FLTAllNullableTypesWithoutRecursion *)everything - completion: - (nonnull void (^)( - FLTAllNullableTypesWithoutRecursion *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI - echoAllNullableTypesWithoutRecursion:everything - completion:^(FLTAllNullableTypesWithoutRecursion *value, - FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableBool:(nullable NSNumber *)aBool - completion: - (void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - [self.flutterAPI echoNullableBool:aBool - completion:^(NSNumber *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableInt:(nullable NSNumber *)anInt - completion: - (void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - [self.flutterAPI echoNullableInt:anInt - completion:^(NSNumber *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableDouble:(nullable NSNumber *)aDouble - completion: - (void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - [self.flutterAPI echoNullableDouble:aDouble - completion:^(NSNumber *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableString:(nullable NSString *)aString - completion: - (void (^)(NSString *_Nullable, FlutterError *_Nullable))completion { - [self.flutterAPI echoNullableString:aString - completion:^(NSString *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableUint8List:(nullable FlutterStandardTypedData *)list - completion:(void (^)(FlutterStandardTypedData *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoNullableUint8List:list - completion:^(FlutterStandardTypedData *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableList:(nullable NSArray *)list - completion: - (void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion { - [self.flutterAPI echoNullableList:list - completion:^(NSArray *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableEnumList:(nullable NSArray *)enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoNullableEnumList:enumList - completion:^(NSArray *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableClassList:(nullable NSArray *)classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI - echoNullableClassList:classList - completion:^(NSArray *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableNonNullEnumList:(nullable NSArray *)enumList - completion: - (nonnull void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI - echoNullableNonNullEnumList:enumList - completion:^(NSArray *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableNonNullClassList:(nullable NSArray *)classList - completion:(nonnull void (^)( - NSArray *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI - echoNullableNonNullClassList:classList - completion:^(NSArray *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableMap:(nullable NSDictionary *)map - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoNullableMap:map - completion:^(NSDictionary *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableStringMap:(nullable NSDictionary *)stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI - echoNullableStringMap:stringMap - completion:^(NSDictionary *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableIntMap:(nullable NSDictionary *)intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI - echoNullableIntMap:intMap - completion:^(NSDictionary *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableEnumMap: - (nullable NSDictionary *)enumMap - completion: - (void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoNullableEnumMap:enumMap - completion:^(NSDictionary *value, - FlutterError *error) { - completion(value, error); - }]; -} - -- (void) - callFlutterEchoNullableClassMap: - (nullable NSDictionary *)classMap - completion: - (void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoNullableClassMap:classMap - completion:^(NSDictionary *value, - FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableNonNullStringMap: - (nullable NSDictionary *)stringMap - completion:(nonnull void (^)( - NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoNullableNonNullStringMap:stringMap - completion:^(NSDictionary *value, - FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableNonNullIntMap:(nullable NSDictionary *)intMap - completion:(nonnull void (^)( - NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoNullableNonNullIntMap:intMap - completion:^(NSDictionary *value, - FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableNonNullEnumMap: - (nullable NSDictionary *)enumMap - completion: - (nonnull void (^)( - NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoNullableNonNullEnumMap:enumMap - completion:^(NSDictionary *value, - FlutterError *error) { - completion(value, error); - }]; -} - -- (void) - callFlutterEchoNullableNonNullClassMap: - (nullable NSDictionary *)classMap - completion: - (nonnull void (^)( - NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI - echoNullableNonNullClassMap:classMap - completion:^(NSDictionary *value, - FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoNullableEnum:(nullable FLTAnEnumBox *)AnEnumBoxed - completion:(void (^)(FLTAnEnumBox *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoNullableEnum:AnEnumBoxed - completion:^(FLTAnEnumBox *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterEchoAnotherNullableEnum:(nullable FLTAnotherEnumBox *)AnotherEnumBoxed - completion:(void (^)(FLTAnotherEnumBox *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterAPI echoAnotherNullableEnum:AnotherEnumBoxed - completion:^(FLTAnotherEnumBox *value, FlutterError *error) { - completion(value, error); - }]; -} - -- (void)callFlutterSmallApiEchoString:(nonnull NSString *)aString - completion:(nonnull void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion { - [self.flutterSmallApiOne - echoString:aString - completion:^(NSString *valueOne, FlutterError *error) { - [self.flutterSmallApiTwo - echoString:aString - completion:^(NSString *valueTwo, FlutterError *error) { - if ([valueOne isEqualToString:valueTwo]) { - completion(valueTwo, error); - } else { - completion( - nil, - [FlutterError - errorWithCode:@"Responses do not match" - message:[NSString stringWithFormat: - @"%@%@%@%@", - @"Multi-instance responses were not matching: ", - valueOne, @", ", valueTwo] - details:nil]); - } - }]; - }]; -} - -- (FLTUnusedClass *)checkIfUnusedClassGenerated { - return [[FLTUnusedClass alloc] init]; -} - -@end - -@interface AlternateLanguageTestAPIWithSuffix () -@end - -@implementation AlternateLanguageTestAPIWithSuffix -+ (void)registerWithRegistrar:(NSObject *)registrar - suffix:(NSString *)suffix { - AlternateLanguageTestAPIWithSuffix *api = [[AlternateLanguageTestAPIWithSuffix alloc] init]; - SetUpFLTHostSmallApiWithSuffix([registrar messenger], api, suffix); -} - -#pragma mark HostSmallAPI implementation - -- (void)echoString:(nonnull NSString *)aString - completion:(nonnull void (^)(NSString *_Nullable, FlutterError *_Nullable))completion { - completion(aString, nil); -} - -- (void)voidVoidWithCompletion:(nonnull void (^)(FlutterError *_Nullable))completion { - completion(nil); -} - -@end diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/CoreTests.gen.h b/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/CoreTests.gen.h deleted file mode 100644 index 3a7b01778b9..00000000000 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/CoreTests.gen.h +++ /dev/null @@ -1,1134 +0,0 @@ -// 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 - -@protocol FlutterBinaryMessenger; -@protocol FlutterMessageCodec; -@class FlutterError; -@class FlutterStandardTypedData; - -NS_ASSUME_NONNULL_BEGIN - -typedef NS_ENUM(NSUInteger, FLTAnEnum) { - FLTAnEnumOne = 0, - FLTAnEnumTwo = 1, - FLTAnEnumThree = 2, - FLTAnEnumFortyTwo = 3, - FLTAnEnumFourHundredTwentyTwo = 4, -}; - -/// Wrapper for FLTAnEnum to allow for nullability. -@interface FLTAnEnumBox : NSObject -@property(nonatomic, assign) FLTAnEnum value; -- (instancetype)initWithValue:(FLTAnEnum)value; -@end - -typedef NS_ENUM(NSUInteger, FLTAnotherEnum) { - FLTAnotherEnumJustInCase = 0, -}; - -/// Wrapper for FLTAnotherEnum to allow for nullability. -@interface FLTAnotherEnumBox : NSObject -@property(nonatomic, assign) FLTAnotherEnum value; -- (instancetype)initWithValue:(FLTAnotherEnum)value; -@end - -@class FLTUnusedClass; -@class FLTAllTypes; -@class FLTAllNullableTypes; -@class FLTAllNullableTypesWithoutRecursion; -@class FLTAllClassesWrapper; -@class FLTTestMessage; - -@interface FLTUnusedClass : NSObject -+ (instancetype)makeWithAField:(nullable id)aField; -@property(nonatomic, strong, nullable) id aField; -@end - -/// A class containing all supported types. -@interface FLTAllTypes : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithABool:(BOOL)aBool - anInt:(NSInteger)anInt - anInt64:(NSInteger)anInt64 - aDouble:(double)aDouble - aByteArray:(FlutterStandardTypedData *)aByteArray - a4ByteArray:(FlutterStandardTypedData *)a4ByteArray - a8ByteArray:(FlutterStandardTypedData *)a8ByteArray - aFloatArray:(FlutterStandardTypedData *)aFloatArray - anEnum:(FLTAnEnum)anEnum - anotherEnum:(FLTAnotherEnum)anotherEnum - aString:(NSString *)aString - anObject:(id)anObject - list:(NSArray *)list - stringList:(NSArray *)stringList - intList:(NSArray *)intList - doubleList:(NSArray *)doubleList - boolList:(NSArray *)boolList - enumList:(NSArray *)enumList - objectList:(NSArray *)objectList - listList:(NSArray *> *)listList - mapList:(NSArray *> *)mapList - map:(NSDictionary *)map - stringMap:(NSDictionary *)stringMap - intMap:(NSDictionary *)intMap - enumMap:(NSDictionary *)enumMap - objectMap:(NSDictionary *)objectMap - listMap:(NSDictionary *> *)listMap - mapMap:(NSDictionary *> *)mapMap; -@property(nonatomic, assign) BOOL aBool; -@property(nonatomic, assign) NSInteger anInt; -@property(nonatomic, assign) NSInteger anInt64; -@property(nonatomic, assign) double aDouble; -@property(nonatomic, strong) FlutterStandardTypedData *aByteArray; -@property(nonatomic, strong) FlutterStandardTypedData *a4ByteArray; -@property(nonatomic, strong) FlutterStandardTypedData *a8ByteArray; -@property(nonatomic, strong) FlutterStandardTypedData *aFloatArray; -@property(nonatomic, assign) FLTAnEnum anEnum; -@property(nonatomic, assign) FLTAnotherEnum anotherEnum; -@property(nonatomic, copy) NSString *aString; -@property(nonatomic, strong) id anObject; -@property(nonatomic, copy) NSArray *list; -@property(nonatomic, copy) NSArray *stringList; -@property(nonatomic, copy) NSArray *intList; -@property(nonatomic, copy) NSArray *doubleList; -@property(nonatomic, copy) NSArray *boolList; -@property(nonatomic, copy) NSArray *enumList; -@property(nonatomic, copy) NSArray *objectList; -@property(nonatomic, copy) NSArray *> *listList; -@property(nonatomic, copy) NSArray *> *mapList; -@property(nonatomic, copy) NSDictionary *map; -@property(nonatomic, copy) NSDictionary *stringMap; -@property(nonatomic, copy) NSDictionary *intMap; -@property(nonatomic, copy) NSDictionary *enumMap; -@property(nonatomic, copy) NSDictionary *objectMap; -@property(nonatomic, copy) NSDictionary *> *listMap; -@property(nonatomic, copy) NSDictionary *> *mapMap; -@end - -/// A class containing all supported nullable types. -@interface FLTAllNullableTypes : NSObject -+ (instancetype) - makeWithANullableBool:(nullable NSNumber *)aNullableBool - aNullableInt:(nullable NSNumber *)aNullableInt - aNullableInt64:(nullable NSNumber *)aNullableInt64 - aNullableDouble:(nullable NSNumber *)aNullableDouble - aNullableByteArray:(nullable FlutterStandardTypedData *)aNullableByteArray - aNullable4ByteArray:(nullable FlutterStandardTypedData *)aNullable4ByteArray - aNullable8ByteArray:(nullable FlutterStandardTypedData *)aNullable8ByteArray - aNullableFloatArray:(nullable FlutterStandardTypedData *)aNullableFloatArray - aNullableEnum:(nullable FLTAnEnumBox *)aNullableEnum - anotherNullableEnum:(nullable FLTAnotherEnumBox *)anotherNullableEnum - aNullableString:(nullable NSString *)aNullableString - aNullableObject:(nullable id)aNullableObject - allNullableTypes:(nullable FLTAllNullableTypes *)allNullableTypes - list:(nullable NSArray *)list - stringList:(nullable NSArray *)stringList - intList:(nullable NSArray *)intList - doubleList:(nullable NSArray *)doubleList - boolList:(nullable NSArray *)boolList - enumList:(nullable NSArray *)enumList - objectList:(nullable NSArray *)objectList - listList:(nullable NSArray *> *)listList - mapList:(nullable NSArray *> *)mapList - recursiveClassList:(nullable NSArray *)recursiveClassList - map:(nullable NSDictionary *)map - stringMap:(nullable NSDictionary *)stringMap - intMap:(nullable NSDictionary *)intMap - enumMap:(nullable NSDictionary *)enumMap - objectMap:(nullable NSDictionary *)objectMap - listMap:(nullable NSDictionary *> *)listMap - mapMap:(nullable NSDictionary *> *)mapMap - recursiveClassMap: - (nullable NSDictionary *)recursiveClassMap; -@property(nonatomic, strong, nullable) NSNumber *aNullableBool; -@property(nonatomic, strong, nullable) NSNumber *aNullableInt; -@property(nonatomic, strong, nullable) NSNumber *aNullableInt64; -@property(nonatomic, strong, nullable) NSNumber *aNullableDouble; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullableByteArray; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullable4ByteArray; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullable8ByteArray; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullableFloatArray; -@property(nonatomic, strong, nullable) FLTAnEnumBox *aNullableEnum; -@property(nonatomic, strong, nullable) FLTAnotherEnumBox *anotherNullableEnum; -@property(nonatomic, copy, nullable) NSString *aNullableString; -@property(nonatomic, strong, nullable) id aNullableObject; -@property(nonatomic, strong, nullable) FLTAllNullableTypes *allNullableTypes; -@property(nonatomic, copy, nullable) NSArray *list; -@property(nonatomic, copy, nullable) NSArray *stringList; -@property(nonatomic, copy, nullable) NSArray *intList; -@property(nonatomic, copy, nullable) NSArray *doubleList; -@property(nonatomic, copy, nullable) NSArray *boolList; -@property(nonatomic, copy, nullable) NSArray *enumList; -@property(nonatomic, copy, nullable) NSArray *objectList; -@property(nonatomic, copy, nullable) NSArray *> *listList; -@property(nonatomic, copy, nullable) NSArray *> *mapList; -@property(nonatomic, copy, nullable) NSArray *recursiveClassList; -@property(nonatomic, copy, nullable) NSDictionary *map; -@property(nonatomic, copy, nullable) NSDictionary *stringMap; -@property(nonatomic, copy, nullable) NSDictionary *intMap; -@property(nonatomic, copy, nullable) NSDictionary *enumMap; -@property(nonatomic, copy, nullable) NSDictionary *objectMap; -@property(nonatomic, copy, nullable) NSDictionary *> *listMap; -@property(nonatomic, copy, nullable) NSDictionary *> *mapMap; -@property(nonatomic, copy, nullable) - NSDictionary *recursiveClassMap; -@end - -/// The primary purpose for this class is to ensure coverage of Swift structs -/// with nullable items, as the primary [AllNullableTypes] class is being used to -/// test Swift classes. -@interface FLTAllNullableTypesWithoutRecursion : NSObject -+ (instancetype) - makeWithANullableBool:(nullable NSNumber *)aNullableBool - aNullableInt:(nullable NSNumber *)aNullableInt - aNullableInt64:(nullable NSNumber *)aNullableInt64 - aNullableDouble:(nullable NSNumber *)aNullableDouble - aNullableByteArray:(nullable FlutterStandardTypedData *)aNullableByteArray - aNullable4ByteArray:(nullable FlutterStandardTypedData *)aNullable4ByteArray - aNullable8ByteArray:(nullable FlutterStandardTypedData *)aNullable8ByteArray - aNullableFloatArray:(nullable FlutterStandardTypedData *)aNullableFloatArray - aNullableEnum:(nullable FLTAnEnumBox *)aNullableEnum - anotherNullableEnum:(nullable FLTAnotherEnumBox *)anotherNullableEnum - aNullableString:(nullable NSString *)aNullableString - aNullableObject:(nullable id)aNullableObject - list:(nullable NSArray *)list - stringList:(nullable NSArray *)stringList - intList:(nullable NSArray *)intList - doubleList:(nullable NSArray *)doubleList - boolList:(nullable NSArray *)boolList - enumList:(nullable NSArray *)enumList - objectList:(nullable NSArray *)objectList - listList:(nullable NSArray *> *)listList - mapList:(nullable NSArray *> *)mapList - map:(nullable NSDictionary *)map - stringMap:(nullable NSDictionary *)stringMap - intMap:(nullable NSDictionary *)intMap - enumMap:(nullable NSDictionary *)enumMap - objectMap:(nullable NSDictionary *)objectMap - listMap:(nullable NSDictionary *> *)listMap - mapMap:(nullable NSDictionary *> *)mapMap; -@property(nonatomic, strong, nullable) NSNumber *aNullableBool; -@property(nonatomic, strong, nullable) NSNumber *aNullableInt; -@property(nonatomic, strong, nullable) NSNumber *aNullableInt64; -@property(nonatomic, strong, nullable) NSNumber *aNullableDouble; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullableByteArray; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullable4ByteArray; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullable8ByteArray; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *aNullableFloatArray; -@property(nonatomic, strong, nullable) FLTAnEnumBox *aNullableEnum; -@property(nonatomic, strong, nullable) FLTAnotherEnumBox *anotherNullableEnum; -@property(nonatomic, copy, nullable) NSString *aNullableString; -@property(nonatomic, strong, nullable) id aNullableObject; -@property(nonatomic, copy, nullable) NSArray *list; -@property(nonatomic, copy, nullable) NSArray *stringList; -@property(nonatomic, copy, nullable) NSArray *intList; -@property(nonatomic, copy, nullable) NSArray *doubleList; -@property(nonatomic, copy, nullable) NSArray *boolList; -@property(nonatomic, copy, nullable) NSArray *enumList; -@property(nonatomic, copy, nullable) NSArray *objectList; -@property(nonatomic, copy, nullable) NSArray *> *listList; -@property(nonatomic, copy, nullable) NSArray *> *mapList; -@property(nonatomic, copy, nullable) NSDictionary *map; -@property(nonatomic, copy, nullable) NSDictionary *stringMap; -@property(nonatomic, copy, nullable) NSDictionary *intMap; -@property(nonatomic, copy, nullable) NSDictionary *enumMap; -@property(nonatomic, copy, nullable) NSDictionary *objectMap; -@property(nonatomic, copy, nullable) NSDictionary *> *listMap; -@property(nonatomic, copy, nullable) NSDictionary *> *mapMap; -@end - -/// A class for testing nested class handling. -/// -/// This is needed to test nested nullable and non-nullable classes, -/// `AllNullableTypes` is non-nullable here as it is easier to instantiate -/// than `AllTypes` when testing doesn't require both (ie. testing null classes). -@interface FLTAllClassesWrapper : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype) - makeWithAllNullableTypes:(FLTAllNullableTypes *)allNullableTypes - allNullableTypesWithoutRecursion: - (nullable FLTAllNullableTypesWithoutRecursion *)allNullableTypesWithoutRecursion - allTypes:(nullable FLTAllTypes *)allTypes - classList:(NSArray *)classList - nullableClassList: - (nullable NSArray *)nullableClassList - classMap:(NSDictionary *)classMap - nullableClassMap: - (nullable NSDictionary *) - nullableClassMap; -@property(nonatomic, strong) FLTAllNullableTypes *allNullableTypes; -@property(nonatomic, strong, nullable) - FLTAllNullableTypesWithoutRecursion *allNullableTypesWithoutRecursion; -@property(nonatomic, strong, nullable) FLTAllTypes *allTypes; -@property(nonatomic, copy) NSArray *classList; -@property(nonatomic, copy, nullable) - NSArray *nullableClassList; -@property(nonatomic, copy) NSDictionary *classMap; -@property(nonatomic, copy, nullable) - NSDictionary *nullableClassMap; -@end - -/// A data class containing a List, used in unit tests. -@interface FLTTestMessage : NSObject -+ (instancetype)makeWithTestList:(nullable NSArray *)testList; -@property(nonatomic, copy, nullable) NSArray *testList; -@end - -/// The codec used by all APIs. -NSObject *FLTGetCoreTestsCodec(void); - -/// The core interface that each host language plugin must implement in -/// platform_test integration tests. -@protocol FLTHostIntegrationCoreApi -/// A no-op function taking no arguments and returning no value, to sanity -/// test basic calling. -- (void)noopWithError:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed object, to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable FLTAllTypes *)echoAllTypes:(FLTAllTypes *)everything - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns an error, to test error handling. -- (nullable id)throwErrorWithError:(FlutterError *_Nullable *_Nonnull)error; -/// Returns an error from a void function, to test error handling. -- (void)throwErrorFromVoidWithError:(FlutterError *_Nullable *_Nonnull)error; -/// Returns a Flutter error, to test error handling. -- (nullable id)throwFlutterErrorWithError:(FlutterError *_Nullable *_Nonnull)error; -/// Returns passed in int. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSNumber *)echoInt:(NSInteger)anInt error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns passed in double. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSNumber *)echoDouble:(double)aDouble error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed in boolean. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSNumber *)echoBool:(BOOL)aBool error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed in string. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSString *)echoString:(NSString *)aString - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed in Uint8List. -/// -/// @return `nil` only when `error != nil`. -- (nullable FlutterStandardTypedData *)echoUint8List:(FlutterStandardTypedData *)aUint8List - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed in generic Object. -/// -/// @return `nil` only when `error != nil`. -- (nullable id)echoObject:(id)anObject error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed list, to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSArray *)echoList:(NSArray *)list - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed list, to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSArray *)echoEnumList:(NSArray *)enumList - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed list, to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSArray *)echoClassList: - (NSArray *)classList - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed list, to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSArray *)echoNonNullEnumList:(NSArray *)enumList - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed list, to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSArray *) - echoNonNullClassList:(NSArray *)classList - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSDictionary *)echoMap:(NSDictionary *)map - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSDictionary *) - echoStringMap:(NSDictionary *)stringMap - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSDictionary *) - echoIntMap:(NSDictionary *)intMap - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSDictionary *) - echoEnumMap:(NSDictionary *)enumMap - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSDictionary *) - echoClassMap:(NSDictionary *)classMap - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSDictionary *) - echoNonNullStringMap:(NSDictionary *)stringMap - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSDictionary *) - echoNonNullIntMap:(NSDictionary *)intMap - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSDictionary *) - echoNonNullEnumMap:(NSDictionary *)enumMap - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSDictionary *) - echoNonNullClassMap:(NSDictionary *)classMap - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed class to test nested class serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (nullable FLTAllClassesWrapper *)echoClassWrapper:(FLTAllClassesWrapper *)wrapper - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed enum to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (FLTAnEnumBox *_Nullable)echoEnum:(FLTAnEnum)anEnum - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed enum to test serialization and deserialization. -/// -/// @return `nil` only when `error != nil`. -- (FLTAnotherEnumBox *_Nullable)echoAnotherEnum:(FLTAnotherEnum)anotherEnum - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the default string. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSString *)echoNamedDefaultString:(NSString *)aString - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns passed in double. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSNumber *)echoOptionalDefaultDouble:(double)aDouble - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns passed in int. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSNumber *)echoRequiredInt:(NSInteger)anInt - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed object, to test serialization and deserialization. -- (nullable FLTAllNullableTypes *)echoAllNullableTypes:(nullable FLTAllNullableTypes *)everything - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed object, to test serialization and deserialization. -- (nullable FLTAllNullableTypesWithoutRecursion *) - echoAllNullableTypesWithoutRecursion:(nullable FLTAllNullableTypesWithoutRecursion *)everything - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the inner `aString` value from the wrapped object, to test -/// sending of nested objects. -- (nullable NSString *)extractNestedNullableStringFrom:(FLTAllClassesWrapper *)wrapper - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the inner `aString` value from the wrapped object, to test -/// sending of nested objects. -/// -/// @return `nil` only when `error != nil`. -- (nullable FLTAllClassesWrapper *) - createNestedObjectWithNullableString:(nullable NSString *)nullableString - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns passed in arguments of multiple types. -/// -/// @return `nil` only when `error != nil`. -- (nullable FLTAllNullableTypes *) - sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool - anInt:(nullable NSNumber *)aNullableInt - aString:(nullable NSString *)aNullableString - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns passed in arguments of multiple types. -/// -/// @return `nil` only when `error != nil`. -- (nullable FLTAllNullableTypesWithoutRecursion *) - sendMultipleNullableTypesWithoutRecursionABool:(nullable NSNumber *)aNullableBool - anInt:(nullable NSNumber *)aNullableInt - aString:(nullable NSString *)aNullableString - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns passed in int. -- (nullable NSNumber *)echoNullableInt:(nullable NSNumber *)aNullableInt - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns passed in double. -- (nullable NSNumber *)echoNullableDouble:(nullable NSNumber *)aNullableDouble - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed in boolean. -- (nullable NSNumber *)echoNullableBool:(nullable NSNumber *)aNullableBool - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed in string. -- (nullable NSString *)echoNullableString:(nullable NSString *)aNullableString - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed in Uint8List. -- (nullable FlutterStandardTypedData *) - echoNullableUint8List:(nullable FlutterStandardTypedData *)aNullableUint8List - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed in generic Object. -- (nullable id)echoNullableObject:(nullable id)aNullableObject - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed list, to test serialization and deserialization. -- (nullable NSArray *)echoNullableList:(nullable NSArray *)aNullableList - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed list, to test serialization and deserialization. -- (nullable NSArray *)echoNullableEnumList: - (nullable NSArray *)enumList - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed list, to test serialization and deserialization. -- (nullable NSArray *) - echoNullableClassList:(nullable NSArray *)classList - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed list, to test serialization and deserialization. -- (nullable NSArray *) - echoNullableNonNullEnumList:(nullable NSArray *)enumList - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed list, to test serialization and deserialization. -- (nullable NSArray *) - echoNullableNonNullClassList:(nullable NSArray *)classList - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -- (nullable NSDictionary *)echoNullableMap:(nullable NSDictionary *)map - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -- (nullable NSDictionary *) - echoNullableStringMap:(nullable NSDictionary *)stringMap - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -- (nullable NSDictionary *) - echoNullableIntMap:(nullable NSDictionary *)intMap - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -- (nullable NSDictionary *) - echoNullableEnumMap:(nullable NSDictionary *)enumMap - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -- (nullable NSDictionary *) - echoNullableClassMap:(nullable NSDictionary *)classMap - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -- (nullable NSDictionary *) - echoNullableNonNullStringMap:(nullable NSDictionary *)stringMap - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -- (nullable NSDictionary *) - echoNullableNonNullIntMap:(nullable NSDictionary *)intMap - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -- (nullable NSDictionary *) - echoNullableNonNullEnumMap:(nullable NSDictionary *)enumMap - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed map, to test serialization and deserialization. -- (nullable NSDictionary *) - echoNullableNonNullClassMap:(nullable NSDictionary *)classMap - error:(FlutterError *_Nullable *_Nonnull)error; -- (FLTAnEnumBox *_Nullable)echoNullableEnum:(nullable FLTAnEnumBox *)anEnumBoxed - error:(FlutterError *_Nullable *_Nonnull)error; -- (FLTAnotherEnumBox *_Nullable)echoAnotherNullableEnum: - (nullable FLTAnotherEnumBox *)anotherEnumBoxed - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns passed in int. -- (nullable NSNumber *)echoOptionalNullableInt:(nullable NSNumber *)aNullableInt - error:(FlutterError *_Nullable *_Nonnull)error; -/// Returns the passed in string. -- (nullable NSString *)echoNamedNullableString:(nullable NSString *)aNullableString - error:(FlutterError *_Nullable *_Nonnull)error; -/// A no-op function taking no arguments and returning no value, to sanity -/// test basic asynchronous calling. -- (void)noopAsyncWithCompletion:(void (^)(FlutterError *_Nullable))completion; -/// Returns passed in int asynchronously. -- (void)echoAsyncInt:(NSInteger)anInt - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -/// Returns passed in double asynchronously. -- (void)echoAsyncDouble:(double)aDouble - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed in boolean asynchronously. -- (void)echoAsyncBool:(BOOL)aBool - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed string asynchronously. -- (void)echoAsyncString:(NSString *)aString - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed in Uint8List asynchronously. -- (void)echoAsyncUint8List:(FlutterStandardTypedData *)aUint8List - completion:(void (^)(FlutterStandardTypedData *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed in generic Object asynchronously. -- (void)echoAsyncObject:(id)anObject - completion:(void (^)(id _Nullable, FlutterError *_Nullable))completion; -/// Returns the passed list, to test asynchronous serialization and deserialization. -- (void)echoAsyncList:(NSArray *)list - completion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed list, to test asynchronous serialization and deserialization. -- (void)echoAsyncEnumList:(NSArray *)enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed list, to test asynchronous serialization and deserialization. -- (void)echoAsyncClassList:(NSArray *)classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test asynchronous serialization and deserialization. -- (void)echoAsyncMap:(NSDictionary *)map - completion:(void (^)(NSDictionary *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed map, to test asynchronous serialization and deserialization. -- (void)echoAsyncStringMap:(NSDictionary *)stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test asynchronous serialization and deserialization. -- (void)echoAsyncIntMap:(NSDictionary *)intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test asynchronous serialization and deserialization. -- (void)echoAsyncEnumMap:(NSDictionary *)enumMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test asynchronous serialization and deserialization. -- (void)echoAsyncClassMap:(NSDictionary *)classMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed enum, to test asynchronous serialization and deserialization. -- (void)echoAsyncEnum:(FLTAnEnum)anEnum - completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed enum, to test asynchronous serialization and deserialization. -- (void)echoAnotherAsyncEnum:(FLTAnotherEnum)anotherEnum - completion: - (void (^)(FLTAnotherEnumBox *_Nullable, FlutterError *_Nullable))completion; -/// Responds with an error from an async function returning a value. -- (void)throwAsyncErrorWithCompletion:(void (^)(id _Nullable, FlutterError *_Nullable))completion; -/// Responds with an error from an async void function. -- (void)throwAsyncErrorFromVoidWithCompletion:(void (^)(FlutterError *_Nullable))completion; -/// Responds with a Flutter error from an async function returning a value. -- (void)throwAsyncFlutterErrorWithCompletion:(void (^)(id _Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed object, to test async serialization and deserialization. -- (void)echoAsyncAllTypes:(FLTAllTypes *)everything - completion:(void (^)(FLTAllTypes *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed object, to test serialization and deserialization. -- (void)echoAsyncNullableAllNullableTypes:(nullable FLTAllNullableTypes *)everything - completion:(void (^)(FLTAllNullableTypes *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed object, to test serialization and deserialization. -- (void)echoAsyncNullableAllNullableTypesWithoutRecursion: - (nullable FLTAllNullableTypesWithoutRecursion *)everything - completion: - (void (^)(FLTAllNullableTypesWithoutRecursion - *_Nullable, - FlutterError *_Nullable))completion; -/// Returns passed in int asynchronously. -- (void)echoAsyncNullableInt:(nullable NSNumber *)anInt - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -/// Returns passed in double asynchronously. -- (void)echoAsyncNullableDouble:(nullable NSNumber *)aDouble - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed in boolean asynchronously. -- (void)echoAsyncNullableBool:(nullable NSNumber *)aBool - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed string asynchronously. -- (void)echoAsyncNullableString:(nullable NSString *)aString - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed in Uint8List asynchronously. -- (void)echoAsyncNullableUint8List:(nullable FlutterStandardTypedData *)aUint8List - completion:(void (^)(FlutterStandardTypedData *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed in generic Object asynchronously. -- (void)echoAsyncNullableObject:(nullable id)anObject - completion:(void (^)(id _Nullable, FlutterError *_Nullable))completion; -/// Returns the passed list, to test asynchronous serialization and deserialization. -- (void)echoAsyncNullableList:(nullable NSArray *)list - completion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed list, to test asynchronous serialization and deserialization. -- (void)echoAsyncNullableEnumList:(nullable NSArray *)enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed list, to test asynchronous serialization and deserialization. -- (void)echoAsyncNullableClassList:(nullable NSArray *)classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test asynchronous serialization and deserialization. -- (void)echoAsyncNullableMap:(nullable NSDictionary *)map - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test asynchronous serialization and deserialization. -- (void)echoAsyncNullableStringMap:(nullable NSDictionary *)stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test asynchronous serialization and deserialization. -- (void)echoAsyncNullableIntMap:(nullable NSDictionary *)intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test asynchronous serialization and deserialization. -- (void)echoAsyncNullableEnumMap:(nullable NSDictionary *)enumMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test asynchronous serialization and deserialization. -- (void) - echoAsyncNullableClassMap:(nullable NSDictionary *)classMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed enum, to test asynchronous serialization and deserialization. -- (void)echoAsyncNullableEnum:(nullable FLTAnEnumBox *)anEnumBoxed - completion: - (void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed enum, to test asynchronous serialization and deserialization. -- (void)echoAnotherAsyncNullableEnum:(nullable FLTAnotherEnumBox *)anotherEnumBoxed - completion:(void (^)(FLTAnotherEnumBox *_Nullable, - FlutterError *_Nullable))completion; -/// Returns true if the handler is run on a main thread, which should be -/// true since there is no TaskQueue annotation. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSNumber *)defaultIsMainThreadWithError:(FlutterError *_Nullable *_Nonnull)error; -/// Returns true if the handler is run on a non-main thread, which should be -/// true for any platform with TaskQueue support. -/// -/// @return `nil` only when `error != nil`. -- (nullable NSNumber *)taskQueueIsBackgroundThreadWithError: - (FlutterError *_Nullable *_Nonnull)error; -- (void)callFlutterNoopWithCompletion:(void (^)(FlutterError *_Nullable))completion; -- (void)callFlutterThrowErrorWithCompletion:(void (^)(id _Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterThrowErrorFromVoidWithCompletion:(void (^)(FlutterError *_Nullable))completion; -- (void)callFlutterEchoAllTypes:(FLTAllTypes *)everything - completion: - (void (^)(FLTAllTypes *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterEchoAllNullableTypes:(nullable FLTAllNullableTypes *)everything - completion:(void (^)(FLTAllNullableTypes *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterSendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool - anInt:(nullable NSNumber *)aNullableInt - aString:(nullable NSString *)aNullableString - completion:(void (^)(FLTAllNullableTypes *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoAllNullableTypesWithoutRecursion: - (nullable FLTAllNullableTypesWithoutRecursion *)everything - completion: - (void (^)( - FLTAllNullableTypesWithoutRecursion *_Nullable, - FlutterError *_Nullable))completion; -- (void) - callFlutterSendMultipleNullableTypesWithoutRecursionABool:(nullable NSNumber *)aNullableBool - anInt:(nullable NSNumber *)aNullableInt - aString:(nullable NSString *)aNullableString - completion: - (void (^)(FLTAllNullableTypesWithoutRecursion - *_Nullable, - FlutterError *_Nullable)) - completion; -- (void)callFlutterEchoBool:(BOOL)aBool - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterEchoInt:(NSInteger)anInt - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterEchoDouble:(double)aDouble - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterEchoString:(NSString *)aString - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterEchoUint8List:(FlutterStandardTypedData *)list - completion:(void (^)(FlutterStandardTypedData *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoList:(NSArray *)list - completion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterEchoEnumList:(NSArray *)enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoClassList:(NSArray *)classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNonNullEnumList:(NSArray *)enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNonNullClassList:(NSArray *)classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoMap:(NSDictionary *)map - completion: - (void (^)(NSDictionary *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterEchoStringMap:(NSDictionary *)stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoIntMap:(NSDictionary *)intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoEnumMap:(NSDictionary *)enumMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoClassMap:(NSDictionary *)classMap - completion: - (void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNonNullStringMap:(NSDictionary *)stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNonNullIntMap:(NSDictionary *)intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNonNullEnumMap:(NSDictionary *)enumMap - completion: - (void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void) - callFlutterEchoNonNullClassMap:(NSDictionary *)classMap - completion: - (void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoEnum:(FLTAnEnum)anEnum - completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterEchoAnotherEnum:(FLTAnotherEnum)anotherEnum - completion:(void (^)(FLTAnotherEnumBox *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableBool:(nullable NSNumber *)aBool - completion: - (void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableInt:(nullable NSNumber *)anInt - completion: - (void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableDouble:(nullable NSNumber *)aDouble - completion: - (void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableString:(nullable NSString *)aString - completion: - (void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableUint8List:(nullable FlutterStandardTypedData *)list - completion:(void (^)(FlutterStandardTypedData *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableList:(nullable NSArray *)list - completion: - (void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableEnumList:(nullable NSArray *)enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableClassList:(nullable NSArray *)classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableNonNullEnumList:(nullable NSArray *)enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableNonNullClassList:(nullable NSArray *)classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableMap:(nullable NSDictionary *)map - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableStringMap:(nullable NSDictionary *)stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableIntMap:(nullable NSDictionary *)intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableEnumMap: - (nullable NSDictionary *)enumMap - completion: - (void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void) - callFlutterEchoNullableClassMap: - (nullable NSDictionary *)classMap - completion: - (void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableNonNullStringMap: - (nullable NSDictionary *)stringMap - completion: - (void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableNonNullIntMap:(nullable NSDictionary *)intMap - completion: - (void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableNonNullEnumMap: - (nullable NSDictionary *)enumMap - completion: - (void (^)( - NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableNonNullClassMap: - (nullable NSDictionary *)classMap - completion: - (void (^)(NSDictionary - *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterEchoNullableEnum:(nullable FLTAnEnumBox *)anEnumBoxed - completion: - (void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion; -- (void)callFlutterEchoAnotherNullableEnum:(nullable FLTAnotherEnumBox *)anotherEnumBoxed - completion:(void (^)(FLTAnotherEnumBox *_Nullable, - FlutterError *_Nullable))completion; -- (void)callFlutterSmallApiEchoString:(NSString *)aString - completion: - (void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -@end - -extern void SetUpFLTHostIntegrationCoreApi(id binaryMessenger, - NSObject *_Nullable api); - -extern void SetUpFLTHostIntegrationCoreApiWithSuffix( - id binaryMessenger, NSObject *_Nullable api, - NSString *messageChannelSuffix); - -/// The core interface that the Dart platform_test code implements for host -/// integration tests to call into. -@interface FLTFlutterIntegrationCoreApi : NSObject -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix; -/// A no-op function taking no arguments and returning no value, to sanity -/// test basic calling. -- (void)noopWithCompletion:(void (^)(FlutterError *_Nullable))completion; -/// Responds with an error from an async function returning a value. -- (void)throwErrorWithCompletion:(void (^)(id _Nullable, FlutterError *_Nullable))completion; -/// Responds with an error from an async void function. -- (void)throwErrorFromVoidWithCompletion:(void (^)(FlutterError *_Nullable))completion; -/// Returns the passed object, to test serialization and deserialization. -- (void)echoAllTypes:(FLTAllTypes *)everything - completion:(void (^)(FLTAllTypes *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed object, to test serialization and deserialization. -- (void)echoAllNullableTypes:(nullable FLTAllNullableTypes *)everything - completion: - (void (^)(FLTAllNullableTypes *_Nullable, FlutterError *_Nullable))completion; -/// Returns passed in arguments of multiple types. -/// -/// Tests multiple-arity FlutterApi handling. -- (void)sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool - anInt:(nullable NSNumber *)aNullableInt - aString:(nullable NSString *)aNullableString - completion:(void (^)(FLTAllNullableTypes *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed object, to test serialization and deserialization. -- (void) - echoAllNullableTypesWithoutRecursion:(nullable FLTAllNullableTypesWithoutRecursion *)everything - completion:(void (^)(FLTAllNullableTypesWithoutRecursion *_Nullable, - FlutterError *_Nullable))completion; -/// Returns passed in arguments of multiple types. -/// -/// Tests multiple-arity FlutterApi handling. -- (void)sendMultipleNullableTypesWithoutRecursionABool:(nullable NSNumber *)aNullableBool - anInt:(nullable NSNumber *)aNullableInt - aString:(nullable NSString *)aNullableString - completion: - (void (^)( - FLTAllNullableTypesWithoutRecursion *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed boolean, to test serialization and deserialization. -- (void)echoBool:(BOOL)aBool - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed int, to test serialization and deserialization. -- (void)echoInt:(NSInteger)anInt - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed double, to test serialization and deserialization. -- (void)echoDouble:(double)aDouble - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed string, to test serialization and deserialization. -- (void)echoString:(NSString *)aString - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed byte list, to test serialization and deserialization. -- (void)echoUint8List:(FlutterStandardTypedData *)list - completion: - (void (^)(FlutterStandardTypedData *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed list, to test serialization and deserialization. -- (void)echoList:(NSArray *)list - completion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed list, to test serialization and deserialization. -- (void)echoEnumList:(NSArray *)enumList - completion: - (void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed list, to test serialization and deserialization. -- (void)echoClassList:(NSArray *)classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed list, to test serialization and deserialization. -- (void)echoNonNullEnumList:(NSArray *)enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed list, to test serialization and deserialization. -- (void)echoNonNullClassList:(NSArray *)classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoMap:(NSDictionary *)map - completion:(void (^)(NSDictionary *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoStringMap:(NSDictionary *)stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoIntMap:(NSDictionary *)intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoEnumMap:(NSDictionary *)enumMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoClassMap:(NSDictionary *)classMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoNonNullStringMap:(NSDictionary *)stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoNonNullIntMap:(NSDictionary *)intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoNonNullEnumMap:(NSDictionary *)enumMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoNonNullClassMap:(NSDictionary *)classMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed enum to test serialization and deserialization. -- (void)echoEnum:(FLTAnEnum)anEnum - completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed enum to test serialization and deserialization. -- (void)echoAnotherEnum:(FLTAnotherEnum)anotherEnum - completion:(void (^)(FLTAnotherEnumBox *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed boolean, to test serialization and deserialization. -- (void)echoNullableBool:(nullable NSNumber *)aBool - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed int, to test serialization and deserialization. -- (void)echoNullableInt:(nullable NSNumber *)anInt - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed double, to test serialization and deserialization. -- (void)echoNullableDouble:(nullable NSNumber *)aDouble - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed string, to test serialization and deserialization. -- (void)echoNullableString:(nullable NSString *)aString - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed byte list, to test serialization and deserialization. -- (void)echoNullableUint8List:(nullable FlutterStandardTypedData *)list - completion:(void (^)(FlutterStandardTypedData *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed list, to test serialization and deserialization. -- (void)echoNullableList:(nullable NSArray *)list - completion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed list, to test serialization and deserialization. -- (void)echoNullableEnumList:(nullable NSArray *)enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed list, to test serialization and deserialization. -- (void)echoNullableClassList:(nullable NSArray *)classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed list, to test serialization and deserialization. -- (void)echoNullableNonNullEnumList:(nullable NSArray *)enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed list, to test serialization and deserialization. -- (void)echoNullableNonNullClassList:(nullable NSArray *)classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoNullableMap:(nullable NSDictionary *)map - completion: - (void (^)(NSDictionary *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoNullableStringMap:(nullable NSDictionary *)stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoNullableIntMap:(nullable NSDictionary *)intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoNullableEnumMap:(nullable NSDictionary *)enumMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoNullableClassMap:(nullable NSDictionary *)classMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoNullableNonNullStringMap:(nullable NSDictionary *)stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoNullableNonNullIntMap:(nullable NSDictionary *)intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoNullableNonNullEnumMap:(nullable NSDictionary *)enumMap - completion: - (void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed map, to test serialization and deserialization. -- (void)echoNullableNonNullClassMap: - (nullable NSDictionary *)classMap - completion: - (void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion; -/// Returns the passed enum to test serialization and deserialization. -- (void)echoNullableEnum:(nullable FLTAnEnumBox *)anEnumBoxed - completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion; -/// Returns the passed enum to test serialization and deserialization. -- (void)echoAnotherNullableEnum:(nullable FLTAnotherEnumBox *)anotherEnumBoxed - completion:(void (^)(FLTAnotherEnumBox *_Nullable, - FlutterError *_Nullable))completion; -/// A no-op function taking no arguments and returning no value, to sanity -/// test basic asynchronous calling. -- (void)noopAsyncWithCompletion:(void (^)(FlutterError *_Nullable))completion; -/// Returns the passed in generic Object asynchronously. -- (void)echoAsyncString:(NSString *)aString - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -@end - -/// An API that can be implemented for minimal, compile-only tests. -@protocol FLTHostTrivialApi -- (void)noopWithError:(FlutterError *_Nullable *_Nonnull)error; -@end - -extern void SetUpFLTHostTrivialApi(id binaryMessenger, - NSObject *_Nullable api); - -extern void SetUpFLTHostTrivialApiWithSuffix(id binaryMessenger, - NSObject *_Nullable api, - NSString *messageChannelSuffix); - -/// A simple API implemented in some unit tests. -@protocol FLTHostSmallApi -- (void)echoString:(NSString *)aString - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -- (void)voidVoidWithCompletion:(void (^)(FlutterError *_Nullable))completion; -@end - -extern void SetUpFLTHostSmallApi(id binaryMessenger, - NSObject *_Nullable api); - -extern void SetUpFLTHostSmallApiWithSuffix(id binaryMessenger, - NSObject *_Nullable api, - NSString *messageChannelSuffix); - -/// A simple API called in some unit tests. -@interface FLTFlutterSmallApi : NSObject -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix; -- (void)echoWrappedList:(FLTTestMessage *)msg - completion:(void (^)(FLTTestMessage *_Nullable, FlutterError *_Nullable))completion; -- (void)echoString:(NSString *)aString - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -@end - -NS_ASSUME_NONNULL_END diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/CoreTests.gen.m b/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/CoreTests.gen.m deleted file mode 100644 index 36fb0a516f5..00000000000 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/Classes/CoreTests.gen.m +++ /dev/null @@ -1,6443 +0,0 @@ -// 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 "CoreTests.gen.h" - -#if TARGET_OS_OSX -#import -#else -#import -#endif - -#if !__has_feature(objc_arc) -#error File requires ARC to be enabled. -#endif - -static NSArray *wrapResult(id result, FlutterError *error) { - if (error) { - return @[ - error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] - ]; - } - return @[ result ?: [NSNull null] ]; -} - -static FlutterError *createConnectionError(NSString *channelName) { - return [FlutterError - errorWithCode:@"channel-error" - message:[NSString stringWithFormat:@"%@/%@/%@", - @"Unable to establish connection on channel: '", - channelName, @"'."] - details:@""]; -} - -static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { - id result = array[key]; - return (result == [NSNull null]) ? nil : result; -} - -@implementation FLTAnEnumBox -- (instancetype)initWithValue:(FLTAnEnum)value { - self = [super init]; - if (self) { - _value = value; - } - return self; -} -@end - -@implementation FLTAnotherEnumBox -- (instancetype)initWithValue:(FLTAnotherEnum)value { - self = [super init]; - if (self) { - _value = value; - } - return self; -} -@end - -@interface FLTUnusedClass () -+ (FLTUnusedClass *)fromList:(NSArray *)list; -+ (nullable FLTUnusedClass *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface FLTAllTypes () -+ (FLTAllTypes *)fromList:(NSArray *)list; -+ (nullable FLTAllTypes *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface FLTAllNullableTypes () -+ (FLTAllNullableTypes *)fromList:(NSArray *)list; -+ (nullable FLTAllNullableTypes *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface FLTAllNullableTypesWithoutRecursion () -+ (FLTAllNullableTypesWithoutRecursion *)fromList:(NSArray *)list; -+ (nullable FLTAllNullableTypesWithoutRecursion *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface FLTAllClassesWrapper () -+ (FLTAllClassesWrapper *)fromList:(NSArray *)list; -+ (nullable FLTAllClassesWrapper *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@interface FLTTestMessage () -+ (FLTTestMessage *)fromList:(NSArray *)list; -+ (nullable FLTTestMessage *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - -@implementation FLTUnusedClass -+ (instancetype)makeWithAField:(nullable id)aField { - FLTUnusedClass *pigeonResult = [[FLTUnusedClass alloc] init]; - pigeonResult.aField = aField; - return pigeonResult; -} -+ (FLTUnusedClass *)fromList:(NSArray *)list { - FLTUnusedClass *pigeonResult = [[FLTUnusedClass alloc] init]; - pigeonResult.aField = GetNullableObjectAtIndex(list, 0); - return pigeonResult; -} -+ (nullable FLTUnusedClass *)nullableFromList:(NSArray *)list { - return (list) ? [FLTUnusedClass fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.aField ?: [NSNull null], - ]; -} -@end - -@implementation FLTAllTypes -+ (instancetype)makeWithABool:(BOOL)aBool - anInt:(NSInteger)anInt - anInt64:(NSInteger)anInt64 - aDouble:(double)aDouble - aByteArray:(FlutterStandardTypedData *)aByteArray - a4ByteArray:(FlutterStandardTypedData *)a4ByteArray - a8ByteArray:(FlutterStandardTypedData *)a8ByteArray - aFloatArray:(FlutterStandardTypedData *)aFloatArray - anEnum:(FLTAnEnum)anEnum - anotherEnum:(FLTAnotherEnum)anotherEnum - aString:(NSString *)aString - anObject:(id)anObject - list:(NSArray *)list - stringList:(NSArray *)stringList - intList:(NSArray *)intList - doubleList:(NSArray *)doubleList - boolList:(NSArray *)boolList - enumList:(NSArray *)enumList - objectList:(NSArray *)objectList - listList:(NSArray *> *)listList - mapList:(NSArray *> *)mapList - map:(NSDictionary *)map - stringMap:(NSDictionary *)stringMap - intMap:(NSDictionary *)intMap - enumMap:(NSDictionary *)enumMap - objectMap:(NSDictionary *)objectMap - listMap:(NSDictionary *> *)listMap - mapMap:(NSDictionary *> *)mapMap { - FLTAllTypes *pigeonResult = [[FLTAllTypes alloc] init]; - pigeonResult.aBool = aBool; - pigeonResult.anInt = anInt; - pigeonResult.anInt64 = anInt64; - pigeonResult.aDouble = aDouble; - pigeonResult.aByteArray = aByteArray; - pigeonResult.a4ByteArray = a4ByteArray; - pigeonResult.a8ByteArray = a8ByteArray; - pigeonResult.aFloatArray = aFloatArray; - pigeonResult.anEnum = anEnum; - pigeonResult.anotherEnum = anotherEnum; - pigeonResult.aString = aString; - pigeonResult.anObject = anObject; - pigeonResult.list = list; - pigeonResult.stringList = stringList; - pigeonResult.intList = intList; - pigeonResult.doubleList = doubleList; - pigeonResult.boolList = boolList; - pigeonResult.enumList = enumList; - pigeonResult.objectList = objectList; - pigeonResult.listList = listList; - pigeonResult.mapList = mapList; - pigeonResult.map = map; - pigeonResult.stringMap = stringMap; - pigeonResult.intMap = intMap; - pigeonResult.enumMap = enumMap; - pigeonResult.objectMap = objectMap; - pigeonResult.listMap = listMap; - pigeonResult.mapMap = mapMap; - return pigeonResult; -} -+ (FLTAllTypes *)fromList:(NSArray *)list { - FLTAllTypes *pigeonResult = [[FLTAllTypes alloc] init]; - pigeonResult.aBool = [GetNullableObjectAtIndex(list, 0) boolValue]; - pigeonResult.anInt = [GetNullableObjectAtIndex(list, 1) integerValue]; - pigeonResult.anInt64 = [GetNullableObjectAtIndex(list, 2) integerValue]; - pigeonResult.aDouble = [GetNullableObjectAtIndex(list, 3) doubleValue]; - pigeonResult.aByteArray = GetNullableObjectAtIndex(list, 4); - pigeonResult.a4ByteArray = GetNullableObjectAtIndex(list, 5); - pigeonResult.a8ByteArray = GetNullableObjectAtIndex(list, 6); - pigeonResult.aFloatArray = GetNullableObjectAtIndex(list, 7); - FLTAnEnumBox *boxedFLTAnEnum = GetNullableObjectAtIndex(list, 8); - pigeonResult.anEnum = boxedFLTAnEnum.value; - FLTAnotherEnumBox *boxedFLTAnotherEnum = GetNullableObjectAtIndex(list, 9); - pigeonResult.anotherEnum = boxedFLTAnotherEnum.value; - pigeonResult.aString = GetNullableObjectAtIndex(list, 10); - pigeonResult.anObject = GetNullableObjectAtIndex(list, 11); - pigeonResult.list = GetNullableObjectAtIndex(list, 12); - pigeonResult.stringList = GetNullableObjectAtIndex(list, 13); - pigeonResult.intList = GetNullableObjectAtIndex(list, 14); - pigeonResult.doubleList = GetNullableObjectAtIndex(list, 15); - pigeonResult.boolList = GetNullableObjectAtIndex(list, 16); - pigeonResult.enumList = GetNullableObjectAtIndex(list, 17); - pigeonResult.objectList = GetNullableObjectAtIndex(list, 18); - pigeonResult.listList = GetNullableObjectAtIndex(list, 19); - pigeonResult.mapList = GetNullableObjectAtIndex(list, 20); - pigeonResult.map = GetNullableObjectAtIndex(list, 21); - pigeonResult.stringMap = GetNullableObjectAtIndex(list, 22); - pigeonResult.intMap = GetNullableObjectAtIndex(list, 23); - pigeonResult.enumMap = GetNullableObjectAtIndex(list, 24); - pigeonResult.objectMap = GetNullableObjectAtIndex(list, 25); - pigeonResult.listMap = GetNullableObjectAtIndex(list, 26); - pigeonResult.mapMap = GetNullableObjectAtIndex(list, 27); - return pigeonResult; -} -+ (nullable FLTAllTypes *)nullableFromList:(NSArray *)list { - return (list) ? [FLTAllTypes fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - @(self.aBool), - @(self.anInt), - @(self.anInt64), - @(self.aDouble), - self.aByteArray ?: [NSNull null], - self.a4ByteArray ?: [NSNull null], - self.a8ByteArray ?: [NSNull null], - self.aFloatArray ?: [NSNull null], - [[FLTAnEnumBox alloc] initWithValue:self.anEnum], - [[FLTAnotherEnumBox alloc] initWithValue:self.anotherEnum], - self.aString ?: [NSNull null], - self.anObject ?: [NSNull null], - self.list ?: [NSNull null], - self.stringList ?: [NSNull null], - self.intList ?: [NSNull null], - self.doubleList ?: [NSNull null], - self.boolList ?: [NSNull null], - self.enumList ?: [NSNull null], - self.objectList ?: [NSNull null], - self.listList ?: [NSNull null], - self.mapList ?: [NSNull null], - self.map ?: [NSNull null], - self.stringMap ?: [NSNull null], - self.intMap ?: [NSNull null], - self.enumMap ?: [NSNull null], - self.objectMap ?: [NSNull null], - self.listMap ?: [NSNull null], - self.mapMap ?: [NSNull null], - ]; -} -@end - -@implementation FLTAllNullableTypes -+ (instancetype) - makeWithANullableBool:(nullable NSNumber *)aNullableBool - aNullableInt:(nullable NSNumber *)aNullableInt - aNullableInt64:(nullable NSNumber *)aNullableInt64 - aNullableDouble:(nullable NSNumber *)aNullableDouble - aNullableByteArray:(nullable FlutterStandardTypedData *)aNullableByteArray - aNullable4ByteArray:(nullable FlutterStandardTypedData *)aNullable4ByteArray - aNullable8ByteArray:(nullable FlutterStandardTypedData *)aNullable8ByteArray - aNullableFloatArray:(nullable FlutterStandardTypedData *)aNullableFloatArray - aNullableEnum:(nullable FLTAnEnumBox *)aNullableEnum - anotherNullableEnum:(nullable FLTAnotherEnumBox *)anotherNullableEnum - aNullableString:(nullable NSString *)aNullableString - aNullableObject:(nullable id)aNullableObject - allNullableTypes:(nullable FLTAllNullableTypes *)allNullableTypes - list:(nullable NSArray *)list - stringList:(nullable NSArray *)stringList - intList:(nullable NSArray *)intList - doubleList:(nullable NSArray *)doubleList - boolList:(nullable NSArray *)boolList - enumList:(nullable NSArray *)enumList - objectList:(nullable NSArray *)objectList - listList:(nullable NSArray *> *)listList - mapList:(nullable NSArray *> *)mapList - recursiveClassList:(nullable NSArray *)recursiveClassList - map:(nullable NSDictionary *)map - stringMap:(nullable NSDictionary *)stringMap - intMap:(nullable NSDictionary *)intMap - enumMap:(nullable NSDictionary *)enumMap - objectMap:(nullable NSDictionary *)objectMap - listMap:(nullable NSDictionary *> *)listMap - mapMap:(nullable NSDictionary *> *)mapMap - recursiveClassMap: - (nullable NSDictionary *)recursiveClassMap { - FLTAllNullableTypes *pigeonResult = [[FLTAllNullableTypes alloc] init]; - pigeonResult.aNullableBool = aNullableBool; - pigeonResult.aNullableInt = aNullableInt; - pigeonResult.aNullableInt64 = aNullableInt64; - pigeonResult.aNullableDouble = aNullableDouble; - pigeonResult.aNullableByteArray = aNullableByteArray; - pigeonResult.aNullable4ByteArray = aNullable4ByteArray; - pigeonResult.aNullable8ByteArray = aNullable8ByteArray; - pigeonResult.aNullableFloatArray = aNullableFloatArray; - pigeonResult.aNullableEnum = aNullableEnum; - pigeonResult.anotherNullableEnum = anotherNullableEnum; - pigeonResult.aNullableString = aNullableString; - pigeonResult.aNullableObject = aNullableObject; - pigeonResult.allNullableTypes = allNullableTypes; - pigeonResult.list = list; - pigeonResult.stringList = stringList; - pigeonResult.intList = intList; - pigeonResult.doubleList = doubleList; - pigeonResult.boolList = boolList; - pigeonResult.enumList = enumList; - pigeonResult.objectList = objectList; - pigeonResult.listList = listList; - pigeonResult.mapList = mapList; - pigeonResult.recursiveClassList = recursiveClassList; - pigeonResult.map = map; - pigeonResult.stringMap = stringMap; - pigeonResult.intMap = intMap; - pigeonResult.enumMap = enumMap; - pigeonResult.objectMap = objectMap; - pigeonResult.listMap = listMap; - pigeonResult.mapMap = mapMap; - pigeonResult.recursiveClassMap = recursiveClassMap; - return pigeonResult; -} -+ (FLTAllNullableTypes *)fromList:(NSArray *)list { - FLTAllNullableTypes *pigeonResult = [[FLTAllNullableTypes alloc] init]; - pigeonResult.aNullableBool = GetNullableObjectAtIndex(list, 0); - pigeonResult.aNullableInt = GetNullableObjectAtIndex(list, 1); - pigeonResult.aNullableInt64 = GetNullableObjectAtIndex(list, 2); - pigeonResult.aNullableDouble = GetNullableObjectAtIndex(list, 3); - pigeonResult.aNullableByteArray = GetNullableObjectAtIndex(list, 4); - pigeonResult.aNullable4ByteArray = GetNullableObjectAtIndex(list, 5); - pigeonResult.aNullable8ByteArray = GetNullableObjectAtIndex(list, 6); - pigeonResult.aNullableFloatArray = GetNullableObjectAtIndex(list, 7); - pigeonResult.aNullableEnum = GetNullableObjectAtIndex(list, 8); - pigeonResult.anotherNullableEnum = GetNullableObjectAtIndex(list, 9); - pigeonResult.aNullableString = GetNullableObjectAtIndex(list, 10); - pigeonResult.aNullableObject = GetNullableObjectAtIndex(list, 11); - pigeonResult.allNullableTypes = GetNullableObjectAtIndex(list, 12); - pigeonResult.list = GetNullableObjectAtIndex(list, 13); - pigeonResult.stringList = GetNullableObjectAtIndex(list, 14); - pigeonResult.intList = GetNullableObjectAtIndex(list, 15); - pigeonResult.doubleList = GetNullableObjectAtIndex(list, 16); - pigeonResult.boolList = GetNullableObjectAtIndex(list, 17); - pigeonResult.enumList = GetNullableObjectAtIndex(list, 18); - pigeonResult.objectList = GetNullableObjectAtIndex(list, 19); - pigeonResult.listList = GetNullableObjectAtIndex(list, 20); - pigeonResult.mapList = GetNullableObjectAtIndex(list, 21); - pigeonResult.recursiveClassList = GetNullableObjectAtIndex(list, 22); - pigeonResult.map = GetNullableObjectAtIndex(list, 23); - pigeonResult.stringMap = GetNullableObjectAtIndex(list, 24); - pigeonResult.intMap = GetNullableObjectAtIndex(list, 25); - pigeonResult.enumMap = GetNullableObjectAtIndex(list, 26); - pigeonResult.objectMap = GetNullableObjectAtIndex(list, 27); - pigeonResult.listMap = GetNullableObjectAtIndex(list, 28); - pigeonResult.mapMap = GetNullableObjectAtIndex(list, 29); - pigeonResult.recursiveClassMap = GetNullableObjectAtIndex(list, 30); - return pigeonResult; -} -+ (nullable FLTAllNullableTypes *)nullableFromList:(NSArray *)list { - return (list) ? [FLTAllNullableTypes fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.aNullableBool ?: [NSNull null], - self.aNullableInt ?: [NSNull null], - self.aNullableInt64 ?: [NSNull null], - self.aNullableDouble ?: [NSNull null], - self.aNullableByteArray ?: [NSNull null], - self.aNullable4ByteArray ?: [NSNull null], - self.aNullable8ByteArray ?: [NSNull null], - self.aNullableFloatArray ?: [NSNull null], - self.aNullableEnum ?: [NSNull null], - self.anotherNullableEnum ?: [NSNull null], - self.aNullableString ?: [NSNull null], - self.aNullableObject ?: [NSNull null], - self.allNullableTypes ?: [NSNull null], - self.list ?: [NSNull null], - self.stringList ?: [NSNull null], - self.intList ?: [NSNull null], - self.doubleList ?: [NSNull null], - self.boolList ?: [NSNull null], - self.enumList ?: [NSNull null], - self.objectList ?: [NSNull null], - self.listList ?: [NSNull null], - self.mapList ?: [NSNull null], - self.recursiveClassList ?: [NSNull null], - self.map ?: [NSNull null], - self.stringMap ?: [NSNull null], - self.intMap ?: [NSNull null], - self.enumMap ?: [NSNull null], - self.objectMap ?: [NSNull null], - self.listMap ?: [NSNull null], - self.mapMap ?: [NSNull null], - self.recursiveClassMap ?: [NSNull null], - ]; -} -@end - -@implementation FLTAllNullableTypesWithoutRecursion -+ (instancetype) - makeWithANullableBool:(nullable NSNumber *)aNullableBool - aNullableInt:(nullable NSNumber *)aNullableInt - aNullableInt64:(nullable NSNumber *)aNullableInt64 - aNullableDouble:(nullable NSNumber *)aNullableDouble - aNullableByteArray:(nullable FlutterStandardTypedData *)aNullableByteArray - aNullable4ByteArray:(nullable FlutterStandardTypedData *)aNullable4ByteArray - aNullable8ByteArray:(nullable FlutterStandardTypedData *)aNullable8ByteArray - aNullableFloatArray:(nullable FlutterStandardTypedData *)aNullableFloatArray - aNullableEnum:(nullable FLTAnEnumBox *)aNullableEnum - anotherNullableEnum:(nullable FLTAnotherEnumBox *)anotherNullableEnum - aNullableString:(nullable NSString *)aNullableString - aNullableObject:(nullable id)aNullableObject - list:(nullable NSArray *)list - stringList:(nullable NSArray *)stringList - intList:(nullable NSArray *)intList - doubleList:(nullable NSArray *)doubleList - boolList:(nullable NSArray *)boolList - enumList:(nullable NSArray *)enumList - objectList:(nullable NSArray *)objectList - listList:(nullable NSArray *> *)listList - mapList:(nullable NSArray *> *)mapList - map:(nullable NSDictionary *)map - stringMap:(nullable NSDictionary *)stringMap - intMap:(nullable NSDictionary *)intMap - enumMap:(nullable NSDictionary *)enumMap - objectMap:(nullable NSDictionary *)objectMap - listMap:(nullable NSDictionary *> *)listMap - mapMap:(nullable NSDictionary *> *)mapMap { - FLTAllNullableTypesWithoutRecursion *pigeonResult = - [[FLTAllNullableTypesWithoutRecursion alloc] init]; - pigeonResult.aNullableBool = aNullableBool; - pigeonResult.aNullableInt = aNullableInt; - pigeonResult.aNullableInt64 = aNullableInt64; - pigeonResult.aNullableDouble = aNullableDouble; - pigeonResult.aNullableByteArray = aNullableByteArray; - pigeonResult.aNullable4ByteArray = aNullable4ByteArray; - pigeonResult.aNullable8ByteArray = aNullable8ByteArray; - pigeonResult.aNullableFloatArray = aNullableFloatArray; - pigeonResult.aNullableEnum = aNullableEnum; - pigeonResult.anotherNullableEnum = anotherNullableEnum; - pigeonResult.aNullableString = aNullableString; - pigeonResult.aNullableObject = aNullableObject; - pigeonResult.list = list; - pigeonResult.stringList = stringList; - pigeonResult.intList = intList; - pigeonResult.doubleList = doubleList; - pigeonResult.boolList = boolList; - pigeonResult.enumList = enumList; - pigeonResult.objectList = objectList; - pigeonResult.listList = listList; - pigeonResult.mapList = mapList; - pigeonResult.map = map; - pigeonResult.stringMap = stringMap; - pigeonResult.intMap = intMap; - pigeonResult.enumMap = enumMap; - pigeonResult.objectMap = objectMap; - pigeonResult.listMap = listMap; - pigeonResult.mapMap = mapMap; - return pigeonResult; -} -+ (FLTAllNullableTypesWithoutRecursion *)fromList:(NSArray *)list { - FLTAllNullableTypesWithoutRecursion *pigeonResult = - [[FLTAllNullableTypesWithoutRecursion alloc] init]; - pigeonResult.aNullableBool = GetNullableObjectAtIndex(list, 0); - pigeonResult.aNullableInt = GetNullableObjectAtIndex(list, 1); - pigeonResult.aNullableInt64 = GetNullableObjectAtIndex(list, 2); - pigeonResult.aNullableDouble = GetNullableObjectAtIndex(list, 3); - pigeonResult.aNullableByteArray = GetNullableObjectAtIndex(list, 4); - pigeonResult.aNullable4ByteArray = GetNullableObjectAtIndex(list, 5); - pigeonResult.aNullable8ByteArray = GetNullableObjectAtIndex(list, 6); - pigeonResult.aNullableFloatArray = GetNullableObjectAtIndex(list, 7); - pigeonResult.aNullableEnum = GetNullableObjectAtIndex(list, 8); - pigeonResult.anotherNullableEnum = GetNullableObjectAtIndex(list, 9); - pigeonResult.aNullableString = GetNullableObjectAtIndex(list, 10); - pigeonResult.aNullableObject = GetNullableObjectAtIndex(list, 11); - pigeonResult.list = GetNullableObjectAtIndex(list, 12); - pigeonResult.stringList = GetNullableObjectAtIndex(list, 13); - pigeonResult.intList = GetNullableObjectAtIndex(list, 14); - pigeonResult.doubleList = GetNullableObjectAtIndex(list, 15); - pigeonResult.boolList = GetNullableObjectAtIndex(list, 16); - pigeonResult.enumList = GetNullableObjectAtIndex(list, 17); - pigeonResult.objectList = GetNullableObjectAtIndex(list, 18); - pigeonResult.listList = GetNullableObjectAtIndex(list, 19); - pigeonResult.mapList = GetNullableObjectAtIndex(list, 20); - pigeonResult.map = GetNullableObjectAtIndex(list, 21); - pigeonResult.stringMap = GetNullableObjectAtIndex(list, 22); - pigeonResult.intMap = GetNullableObjectAtIndex(list, 23); - pigeonResult.enumMap = GetNullableObjectAtIndex(list, 24); - pigeonResult.objectMap = GetNullableObjectAtIndex(list, 25); - pigeonResult.listMap = GetNullableObjectAtIndex(list, 26); - pigeonResult.mapMap = GetNullableObjectAtIndex(list, 27); - return pigeonResult; -} -+ (nullable FLTAllNullableTypesWithoutRecursion *)nullableFromList:(NSArray *)list { - return (list) ? [FLTAllNullableTypesWithoutRecursion fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.aNullableBool ?: [NSNull null], - self.aNullableInt ?: [NSNull null], - self.aNullableInt64 ?: [NSNull null], - self.aNullableDouble ?: [NSNull null], - self.aNullableByteArray ?: [NSNull null], - self.aNullable4ByteArray ?: [NSNull null], - self.aNullable8ByteArray ?: [NSNull null], - self.aNullableFloatArray ?: [NSNull null], - self.aNullableEnum ?: [NSNull null], - self.anotherNullableEnum ?: [NSNull null], - self.aNullableString ?: [NSNull null], - self.aNullableObject ?: [NSNull null], - self.list ?: [NSNull null], - self.stringList ?: [NSNull null], - self.intList ?: [NSNull null], - self.doubleList ?: [NSNull null], - self.boolList ?: [NSNull null], - self.enumList ?: [NSNull null], - self.objectList ?: [NSNull null], - self.listList ?: [NSNull null], - self.mapList ?: [NSNull null], - self.map ?: [NSNull null], - self.stringMap ?: [NSNull null], - self.intMap ?: [NSNull null], - self.enumMap ?: [NSNull null], - self.objectMap ?: [NSNull null], - self.listMap ?: [NSNull null], - self.mapMap ?: [NSNull null], - ]; -} -@end - -@implementation FLTAllClassesWrapper -+ (instancetype) - makeWithAllNullableTypes:(FLTAllNullableTypes *)allNullableTypes - allNullableTypesWithoutRecursion: - (nullable FLTAllNullableTypesWithoutRecursion *)allNullableTypesWithoutRecursion - allTypes:(nullable FLTAllTypes *)allTypes - classList:(NSArray *)classList - nullableClassList: - (nullable NSArray *)nullableClassList - classMap:(NSDictionary *)classMap - nullableClassMap: - (nullable NSDictionary *) - nullableClassMap { - FLTAllClassesWrapper *pigeonResult = [[FLTAllClassesWrapper alloc] init]; - pigeonResult.allNullableTypes = allNullableTypes; - pigeonResult.allNullableTypesWithoutRecursion = allNullableTypesWithoutRecursion; - pigeonResult.allTypes = allTypes; - pigeonResult.classList = classList; - pigeonResult.nullableClassList = nullableClassList; - pigeonResult.classMap = classMap; - pigeonResult.nullableClassMap = nullableClassMap; - return pigeonResult; -} -+ (FLTAllClassesWrapper *)fromList:(NSArray *)list { - FLTAllClassesWrapper *pigeonResult = [[FLTAllClassesWrapper alloc] init]; - pigeonResult.allNullableTypes = GetNullableObjectAtIndex(list, 0); - pigeonResult.allNullableTypesWithoutRecursion = GetNullableObjectAtIndex(list, 1); - pigeonResult.allTypes = GetNullableObjectAtIndex(list, 2); - pigeonResult.classList = GetNullableObjectAtIndex(list, 3); - pigeonResult.nullableClassList = GetNullableObjectAtIndex(list, 4); - pigeonResult.classMap = GetNullableObjectAtIndex(list, 5); - pigeonResult.nullableClassMap = GetNullableObjectAtIndex(list, 6); - return pigeonResult; -} -+ (nullable FLTAllClassesWrapper *)nullableFromList:(NSArray *)list { - return (list) ? [FLTAllClassesWrapper fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.allNullableTypes ?: [NSNull null], - self.allNullableTypesWithoutRecursion ?: [NSNull null], - self.allTypes ?: [NSNull null], - self.classList ?: [NSNull null], - self.nullableClassList ?: [NSNull null], - self.classMap ?: [NSNull null], - self.nullableClassMap ?: [NSNull null], - ]; -} -@end - -@implementation FLTTestMessage -+ (instancetype)makeWithTestList:(nullable NSArray *)testList { - FLTTestMessage *pigeonResult = [[FLTTestMessage alloc] init]; - pigeonResult.testList = testList; - return pigeonResult; -} -+ (FLTTestMessage *)fromList:(NSArray *)list { - FLTTestMessage *pigeonResult = [[FLTTestMessage alloc] init]; - pigeonResult.testList = GetNullableObjectAtIndex(list, 0); - return pigeonResult; -} -+ (nullable FLTTestMessage *)nullableFromList:(NSArray *)list { - return (list) ? [FLTTestMessage fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - self.testList ?: [NSNull null], - ]; -} -@end - -@interface FLTCoreTestsPigeonCodecReader : FlutterStandardReader -@end -@implementation FLTCoreTestsPigeonCodecReader -- (nullable id)readValueOfType:(UInt8)type { - switch (type) { - case 129: { - NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FLTAnEnumBox alloc] initWithValue:[enumAsNumber integerValue]]; - } - case 130: { - NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FLTAnotherEnumBox alloc] initWithValue:[enumAsNumber integerValue]]; - } - case 131: - return [FLTUnusedClass fromList:[self readValue]]; - case 132: - return [FLTAllTypes fromList:[self readValue]]; - case 133: - return [FLTAllNullableTypes fromList:[self readValue]]; - case 134: - return [FLTAllNullableTypesWithoutRecursion fromList:[self readValue]]; - case 135: - return [FLTAllClassesWrapper fromList:[self readValue]]; - case 136: - return [FLTTestMessage fromList:[self readValue]]; - default: - return [super readValueOfType:type]; - } -} -@end - -@interface FLTCoreTestsPigeonCodecWriter : FlutterStandardWriter -@end -@implementation FLTCoreTestsPigeonCodecWriter -- (void)writeValue:(id)value { - if ([value isKindOfClass:[FLTAnEnumBox class]]) { - FLTAnEnumBox *box = (FLTAnEnumBox *)value; - [self writeByte:129]; - [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; - } else if ([value isKindOfClass:[FLTAnotherEnumBox class]]) { - FLTAnotherEnumBox *box = (FLTAnotherEnumBox *)value; - [self writeByte:130]; - [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; - } else if ([value isKindOfClass:[FLTUnusedClass class]]) { - [self writeByte:131]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FLTAllTypes class]]) { - [self writeByte:132]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FLTAllNullableTypes class]]) { - [self writeByte:133]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FLTAllNullableTypesWithoutRecursion class]]) { - [self writeByte:134]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FLTAllClassesWrapper class]]) { - [self writeByte:135]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FLTTestMessage class]]) { - [self writeByte:136]; - [self writeValue:[value toList]]; - } else { - [super writeValue:value]; - } -} -@end - -@interface FLTCoreTestsPigeonCodecReaderWriter : FlutterStandardReaderWriter -@end -@implementation FLTCoreTestsPigeonCodecReaderWriter -- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { - return [[FLTCoreTestsPigeonCodecWriter alloc] initWithData:data]; -} -- (FlutterStandardReader *)readerWithData:(NSData *)data { - return [[FLTCoreTestsPigeonCodecReader alloc] initWithData:data]; -} -@end - -NSObject *FLTGetCoreTestsCodec(void) { - static FlutterStandardMessageCodec *sSharedObject = nil; - static dispatch_once_t sPred = 0; - dispatch_once(&sPred, ^{ - FLTCoreTestsPigeonCodecReaderWriter *readerWriter = - [[FLTCoreTestsPigeonCodecReaderWriter alloc] init]; - sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; - }); - return sSharedObject; -} -void SetUpFLTHostIntegrationCoreApi(id binaryMessenger, - NSObject *api) { - SetUpFLTHostIntegrationCoreApiWithSuffix(binaryMessenger, api, @""); -} - -void SetUpFLTHostIntegrationCoreApiWithSuffix(id binaryMessenger, - NSObject *api, - NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; -#if TARGET_OS_IOS - NSObject *taskQueue = [binaryMessenger makeBackgroundTaskQueue]; -#else - NSObject *taskQueue = nil; -#endif - /// A no-op function taking no arguments and returning no value, to sanity - /// test basic calling. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.noop", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(noopWithError:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(noopWithError:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - FlutterError *error; - [api noopWithError:&error]; - callback(wrapResult(nil, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed object, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAllTypes", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(echoAllTypes:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoAllTypes:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAllTypes *arg_everything = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - FLTAllTypes *output = [api echoAllTypes:arg_everything error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns an error, to test error handling. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.throwError", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(throwErrorWithError:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(throwErrorWithError:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - FlutterError *error; - id output = [api throwErrorWithError:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns an error from a void function, to test error handling. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.throwErrorFromVoid", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(throwErrorFromVoidWithError:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(throwErrorFromVoidWithError:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - FlutterError *error; - [api throwErrorFromVoidWithError:&error]; - callback(wrapResult(nil, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns a Flutter error, to test error handling. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.throwFlutterError", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(throwFlutterErrorWithError:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(throwFlutterErrorWithError:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - FlutterError *error; - id output = [api throwFlutterErrorWithError:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns passed in int. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoInt", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoInt:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoInt:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSInteger arg_anInt = [GetNullableObjectAtIndex(args, 0) integerValue]; - FlutterError *error; - NSNumber *output = [api echoInt:arg_anInt error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns passed in double. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoDouble", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(echoDouble:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoDouble:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - double arg_aDouble = [GetNullableObjectAtIndex(args, 0) doubleValue]; - FlutterError *error; - NSNumber *output = [api echoDouble:arg_aDouble error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed in boolean. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoBool", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoBool:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoBool:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - BOOL arg_aBool = [GetNullableObjectAtIndex(args, 0) boolValue]; - FlutterError *error; - NSNumber *output = [api echoBool:arg_aBool error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed in string. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoString", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(echoString:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoString:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_aString = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSString *output = [api echoString:arg_aString error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed in Uint8List. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoUint8List", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(echoUint8List:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoUint8List:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FlutterStandardTypedData *arg_aUint8List = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - FlutterStandardTypedData *output = [api echoUint8List:arg_aUint8List error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed in generic Object. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoObject", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(echoObject:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoObject:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - id arg_anObject = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - id output = [api echoObject:arg_anObject error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoList:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoList:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_list = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSArray *output = [api echoList:arg_list error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoEnumList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(echoEnumList:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoEnumList:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_enumList = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSArray *output = [api echoEnumList:arg_enumList error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoClassList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(echoClassList:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoClassList:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_classList = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSArray *output = [api echoClassList:arg_classList error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNonNullEnumList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNonNullEnumList:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNonNullEnumList:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_enumList = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSArray *output = [api echoNonNullEnumList:arg_enumList error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNonNullClassList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNonNullClassList:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNonNullClassList:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_classList = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSArray *output = [api echoNonNullClassList:arg_classList - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_map = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = [api echoMap:arg_map error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoStringMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(echoStringMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoStringMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_stringMap = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = [api echoStringMap:arg_stringMap - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoIntMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(echoIntMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoIntMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_intMap = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = [api echoIntMap:arg_intMap error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoEnumMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(echoEnumMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoEnumMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_enumMap = - GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = [api echoEnumMap:arg_enumMap - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoClassMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector(echoClassMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoClassMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_classMap = - GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = [api echoClassMap:arg_classMap - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNonNullStringMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNonNullStringMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNonNullStringMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_stringMap = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = [api echoNonNullStringMap:arg_stringMap - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNonNullIntMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNonNullIntMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNonNullIntMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_intMap = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = [api echoNonNullIntMap:arg_intMap - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNonNullEnumMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNonNullEnumMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNonNullEnumMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_enumMap = - GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = [api echoNonNullEnumMap:arg_enumMap - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNonNullClassMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNonNullClassMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNonNullClassMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_classMap = - GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = - [api echoNonNullClassMap:arg_classMap error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed class to test nested class serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoClassWrapper", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoClassWrapper:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoClassWrapper:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAllClassesWrapper *arg_wrapper = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - FLTAllClassesWrapper *output = [api echoClassWrapper:arg_wrapper error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed enum to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoEnum", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoEnum:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to @selector(echoEnum:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAnEnumBox *boxedFLTAnEnum = GetNullableObjectAtIndex(args, 0); - FLTAnEnum arg_anEnum = boxedFLTAnEnum.value; - FlutterError *error; - FLTAnEnumBox *output = [api echoEnum:arg_anEnum error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed enum to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAnotherEnum", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAnotherEnum:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAnotherEnum:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAnotherEnumBox *boxedFLTAnotherEnum = GetNullableObjectAtIndex(args, 0); - FLTAnotherEnum arg_anotherEnum = boxedFLTAnotherEnum.value; - FlutterError *error; - FLTAnotherEnumBox *output = [api echoAnotherEnum:arg_anotherEnum error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the default string. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNamedDefaultString", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNamedDefaultString:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNamedDefaultString:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_aString = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSString *output = [api echoNamedDefaultString:arg_aString error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns passed in double. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoOptionalDefaultDouble", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoOptionalDefaultDouble:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoOptionalDefaultDouble:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - double arg_aDouble = [GetNullableObjectAtIndex(args, 0) doubleValue]; - FlutterError *error; - NSNumber *output = [api echoOptionalDefaultDouble:arg_aDouble error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns passed in int. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoRequiredInt", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoRequiredInt:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoRequiredInt:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSInteger arg_anInt = [GetNullableObjectAtIndex(args, 0) integerValue]; - FlutterError *error; - NSNumber *output = [api echoRequiredInt:arg_anInt error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed object, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAllNullableTypes", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAllNullableTypes:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAllNullableTypes:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAllNullableTypes *arg_everything = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - FLTAllNullableTypes *output = [api echoAllNullableTypes:arg_everything error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed object, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAllNullableTypesWithoutRecursion", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAllNullableTypesWithoutRecursion:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAllNullableTypesWithoutRecursion:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAllNullableTypesWithoutRecursion *arg_everything = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - FLTAllNullableTypesWithoutRecursion *output = - [api echoAllNullableTypesWithoutRecursion:arg_everything error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the inner `aString` value from the wrapped object, to test - /// sending of nested objects. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.extractNestedNullableString", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(extractNestedNullableStringFrom:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(extractNestedNullableStringFrom:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAllClassesWrapper *arg_wrapper = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSString *output = [api extractNestedNullableStringFrom:arg_wrapper error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the inner `aString` value from the wrapped object, to test - /// sending of nested objects. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.createNestedNullableString", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(createNestedObjectWithNullableString:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(createNestedObjectWithNullableString:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_nullableString = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - FLTAllClassesWrapper *output = [api createNestedObjectWithNullableString:arg_nullableString - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns passed in arguments of multiple types. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.sendMultipleNullableTypes", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(sendMultipleNullableTypesABool: - anInt:aString:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(sendMultipleNullableTypesABool:anInt:aString:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_aNullableBool = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_aNullableInt = GetNullableObjectAtIndex(args, 1); - NSString *arg_aNullableString = GetNullableObjectAtIndex(args, 2); - FlutterError *error; - FLTAllNullableTypes *output = [api sendMultipleNullableTypesABool:arg_aNullableBool - anInt:arg_aNullableInt - aString:arg_aNullableString - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns passed in arguments of multiple types. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.sendMultipleNullableTypesWithoutRecursion", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector - (sendMultipleNullableTypesWithoutRecursionABool:anInt:aString:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(sendMultipleNullableTypesWithoutRecursionABool:anInt:aString:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_aNullableBool = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_aNullableInt = GetNullableObjectAtIndex(args, 1); - NSString *arg_aNullableString = GetNullableObjectAtIndex(args, 2); - FlutterError *error; - FLTAllNullableTypesWithoutRecursion *output = - [api sendMultipleNullableTypesWithoutRecursionABool:arg_aNullableBool - anInt:arg_aNullableInt - aString:arg_aNullableString - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns passed in int. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableInt", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableInt:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableInt:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_aNullableInt = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSNumber *output = [api echoNullableInt:arg_aNullableInt error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns passed in double. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableDouble", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableDouble:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableDouble:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_aNullableDouble = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSNumber *output = [api echoNullableDouble:arg_aNullableDouble error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed in boolean. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableBool", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableBool:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableBool:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_aNullableBool = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSNumber *output = [api echoNullableBool:arg_aNullableBool error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed in string. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableString", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableString:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableString:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_aNullableString = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSString *output = [api echoNullableString:arg_aNullableString error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed in Uint8List. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableUint8List", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableUint8List:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableUint8List:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FlutterStandardTypedData *arg_aNullableUint8List = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - FlutterStandardTypedData *output = [api echoNullableUint8List:arg_aNullableUint8List - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed in generic Object. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableObject", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableObject:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableObject:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - id arg_aNullableObject = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - id output = [api echoNullableObject:arg_aNullableObject error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableList:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableList:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_aNullableList = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSArray *output = [api echoNullableList:arg_aNullableList error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableEnumList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableEnumList:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableEnumList:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_enumList = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSArray *output = [api echoNullableEnumList:arg_enumList error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableClassList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableClassList:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableClassList:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_classList = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSArray *output = [api echoNullableClassList:arg_classList - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableNonNullEnumList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableNonNullEnumList:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableNonNullEnumList:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_enumList = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSArray *output = [api echoNullableNonNullEnumList:arg_enumList - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableNonNullClassList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableNonNullClassList:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableNonNullClassList:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_classList = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSArray *output = [api echoNullableNonNullClassList:arg_classList - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_map = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = [api echoNullableMap:arg_map error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableStringMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableStringMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableStringMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_stringMap = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = [api echoNullableStringMap:arg_stringMap - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableIntMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableIntMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableIntMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_intMap = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = [api echoNullableIntMap:arg_intMap - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableEnumMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableEnumMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableEnumMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_enumMap = - GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = [api echoNullableEnumMap:arg_enumMap - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableClassMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableClassMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableClassMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_classMap = - GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = - [api echoNullableClassMap:arg_classMap error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableNonNullStringMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableNonNullStringMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableNonNullStringMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_stringMap = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = - [api echoNullableNonNullStringMap:arg_stringMap error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableNonNullIntMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableNonNullIntMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableNonNullIntMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_intMap = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = [api echoNullableNonNullIntMap:arg_intMap - error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableNonNullEnumMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableNonNullEnumMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableNonNullEnumMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_enumMap = - GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = - [api echoNullableNonNullEnumMap:arg_enumMap error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableNonNullClassMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableNonNullClassMap:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableNonNullClassMap:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_classMap = - GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSDictionary *output = - [api echoNullableNonNullClassMap:arg_classMap error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNullableEnum", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNullableEnum:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNullableEnum:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAnEnumBox *arg_anEnum = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - FLTAnEnumBox *output = [api echoNullableEnum:arg_anEnum error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAnotherNullableEnum", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAnotherNullableEnum:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAnotherNullableEnum:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAnotherEnumBox *arg_anotherEnum = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - FLTAnotherEnumBox *output = [api echoAnotherNullableEnum:arg_anotherEnum error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns passed in int. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoOptionalNullableInt", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoOptionalNullableInt:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoOptionalNullableInt:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_aNullableInt = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSNumber *output = [api echoOptionalNullableInt:arg_aNullableInt error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed in string. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoNamedNullableString", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoNamedNullableString:error:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoNamedNullableString:error:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_aNullableString = GetNullableObjectAtIndex(args, 0); - FlutterError *error; - NSString *output = [api echoNamedNullableString:arg_aNullableString error:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// A no-op function taking no arguments and returning no value, to sanity - /// test basic asynchronous calling. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.noopAsync", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(noopAsyncWithCompletion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(noopAsyncWithCompletion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api noopAsyncWithCompletion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns passed in int asynchronously. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncInt", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncInt:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncInt:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSInteger arg_anInt = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api echoAsyncInt:arg_anInt - completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns passed in double asynchronously. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncDouble", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncDouble:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncDouble:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - double arg_aDouble = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api echoAsyncDouble:arg_aDouble - completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed in boolean asynchronously. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncBool", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncBool:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncBool:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - BOOL arg_aBool = [GetNullableObjectAtIndex(args, 0) boolValue]; - [api echoAsyncBool:arg_aBool - completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed string asynchronously. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncString", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncString:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncString:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_aString = GetNullableObjectAtIndex(args, 0); - [api echoAsyncString:arg_aString - completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed in Uint8List asynchronously. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncUint8List", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncUint8List:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncUint8List:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FlutterStandardTypedData *arg_aUint8List = GetNullableObjectAtIndex(args, 0); - [api echoAsyncUint8List:arg_aUint8List - completion:^(FlutterStandardTypedData *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed in generic Object asynchronously. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncObject", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncObject:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncObject:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - id arg_anObject = GetNullableObjectAtIndex(args, 0); - [api echoAsyncObject:arg_anObject - completion:^(id _Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncList:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_list = GetNullableObjectAtIndex(args, 0); - [api echoAsyncList:arg_list - completion:^(NSArray *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncEnumList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncEnumList:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncEnumList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_enumList = GetNullableObjectAtIndex(args, 0); - [api echoAsyncEnumList:arg_enumList - completion:^(NSArray *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncClassList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncClassList:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncClassList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_classList = GetNullableObjectAtIndex(args, 0); - [api echoAsyncClassList:arg_classList - completion:^(NSArray *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_map = GetNullableObjectAtIndex(args, 0); - [api echoAsyncMap:arg_map - completion:^(NSDictionary *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncStringMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncStringMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncStringMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_stringMap = GetNullableObjectAtIndex(args, 0); - [api echoAsyncStringMap:arg_stringMap - completion:^(NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncIntMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncIntMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncIntMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_intMap = GetNullableObjectAtIndex(args, 0); - [api echoAsyncIntMap:arg_intMap - completion:^(NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncEnumMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncEnumMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncEnumMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_enumMap = - GetNullableObjectAtIndex(args, 0); - [api echoAsyncEnumMap:arg_enumMap - completion:^(NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncClassMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncClassMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncClassMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_classMap = - GetNullableObjectAtIndex(args, 0); - [api echoAsyncClassMap:arg_classMap - completion:^(NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed enum, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncEnum", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncEnum:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncEnum:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAnEnumBox *boxedFLTAnEnum = GetNullableObjectAtIndex(args, 0); - FLTAnEnum arg_anEnum = boxedFLTAnEnum.value; - [api echoAsyncEnum:arg_anEnum - completion:^(FLTAnEnumBox *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed enum, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAnotherAsyncEnum", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAnotherAsyncEnum:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAnotherAsyncEnum:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAnotherEnumBox *boxedFLTAnotherEnum = GetNullableObjectAtIndex(args, 0); - FLTAnotherEnum arg_anotherEnum = boxedFLTAnotherEnum.value; - [api echoAnotherAsyncEnum:arg_anotherEnum - completion:^(FLTAnotherEnumBox *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Responds with an error from an async function returning a value. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.throwAsyncError", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(throwAsyncErrorWithCompletion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(throwAsyncErrorWithCompletion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api throwAsyncErrorWithCompletion:^(id _Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Responds with an error from an async void function. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.throwAsyncErrorFromVoid", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(throwAsyncErrorFromVoidWithCompletion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(throwAsyncErrorFromVoidWithCompletion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api throwAsyncErrorFromVoidWithCompletion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Responds with a Flutter error from an async function returning a value. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.throwAsyncFlutterError", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(throwAsyncFlutterErrorWithCompletion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(throwAsyncFlutterErrorWithCompletion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api throwAsyncFlutterErrorWithCompletion:^(id _Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed object, to test async serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncAllTypes", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncAllTypes:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncAllTypes:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAllTypes *arg_everything = GetNullableObjectAtIndex(args, 0); - [api echoAsyncAllTypes:arg_everything - completion:^(FLTAllTypes *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed object, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableAllNullableTypes:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableAllNullableTypes:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAllNullableTypes *arg_everything = GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableAllNullableTypes:arg_everything - completion:^(FLTAllNullableTypes *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed object, to test serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi." - @"echoAsyncNullableAllNullableTypesWithoutRecursion", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector - (echoAsyncNullableAllNullableTypesWithoutRecursion:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableAllNullableTypesWithoutRecursion:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAllNullableTypesWithoutRecursion *arg_everything = GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableAllNullableTypesWithoutRecursion:arg_everything - completion:^(FLTAllNullableTypesWithoutRecursion - *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns passed in int asynchronously. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableInt", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableInt:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableInt:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_anInt = GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableInt:arg_anInt - completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns passed in double asynchronously. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableDouble", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableDouble:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableDouble:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_aDouble = GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableDouble:arg_aDouble - completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed in boolean asynchronously. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableBool", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableBool:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableBool:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_aBool = GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableBool:arg_aBool - completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed string asynchronously. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableString", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableString:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableString:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_aString = GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableString:arg_aString - completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed in Uint8List asynchronously. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableUint8List", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableUint8List:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableUint8List:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FlutterStandardTypedData *arg_aUint8List = GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableUint8List:arg_aUint8List - completion:^(FlutterStandardTypedData *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed in generic Object asynchronously. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableObject", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableObject:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableObject:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - id arg_anObject = GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableObject:arg_anObject - completion:^(id _Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableList:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_list = GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableList:arg_list - completion:^(NSArray *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableEnumList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableEnumList:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableEnumList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_enumList = GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableEnumList:arg_enumList - completion:^(NSArray *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed list, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableClassList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableClassList:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableClassList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_classList = GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableClassList:arg_classList - completion:^(NSArray *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_map = GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableMap:arg_map - completion:^(NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableStringMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableStringMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableStringMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_stringMap = GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableStringMap:arg_stringMap - completion:^(NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableIntMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableIntMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableIntMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_intMap = GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableIntMap:arg_intMap - completion:^(NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableEnumMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableEnumMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableEnumMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_enumMap = - GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableEnumMap:arg_enumMap - completion:^( - NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableClassMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableClassMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableClassMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_classMap = - GetNullableObjectAtIndex(args, 0); - [api echoAsyncNullableClassMap:arg_classMap - completion:^( - NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed enum, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAsyncNullableEnum", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAsyncNullableEnum:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAsyncNullableEnum:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAnEnumBox *arg_anEnum = GetNullableObjectAtIndex(args, 0); - [api - echoAsyncNullableEnum:arg_anEnum - completion:^(FLTAnEnumBox *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns the passed enum, to test asynchronous serialization and deserialization. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.echoAnotherAsyncNullableEnum", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoAnotherAsyncNullableEnum:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(echoAnotherAsyncNullableEnum:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAnotherEnumBox *arg_anotherEnum = GetNullableObjectAtIndex(args, 0); - [api echoAnotherAsyncNullableEnum:arg_anotherEnum - completion:^(FLTAnotherEnumBox *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns true if the handler is run on a main thread, which should be - /// true since there is no TaskQueue annotation. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.defaultIsMainThread", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(defaultIsMainThreadWithError:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(defaultIsMainThreadWithError:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - FlutterError *error; - NSNumber *output = [api defaultIsMainThreadWithError:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - /// Returns true if the handler is run on a non-main thread, which should be - /// true for any platform with TaskQueue support. - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.taskQueueIsBackgroundThread", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec() -#ifdef TARGET_OS_IOS - taskQueue:taskQueue -#endif - ]; - - if (api) { - NSCAssert([api respondsToSelector:@selector(taskQueueIsBackgroundThreadWithError:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(taskQueueIsBackgroundThreadWithError:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - FlutterError *error; - NSNumber *output = [api taskQueueIsBackgroundThreadWithError:&error]; - callback(wrapResult(output, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterNoop", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterNoopWithCompletion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterNoopWithCompletion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api callFlutterNoopWithCompletion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterThrowError", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterThrowErrorWithCompletion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterThrowErrorWithCompletion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api callFlutterThrowErrorWithCompletion:^(id _Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterThrowErrorFromVoidWithCompletion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterThrowErrorFromVoidWithCompletion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api callFlutterThrowErrorFromVoidWithCompletion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoAllTypes", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoAllTypes:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoAllTypes:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAllTypes *arg_everything = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoAllTypes:arg_everything - completion:^(FLTAllTypes *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoAllNullableTypes:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoAllNullableTypes:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAllNullableTypes *arg_everything = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoAllNullableTypes:arg_everything - completion:^(FLTAllNullableTypes *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector - (callFlutterSendMultipleNullableTypesABool:anInt:aString:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterSendMultipleNullableTypesABool:anInt:aString:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_aNullableBool = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_aNullableInt = GetNullableObjectAtIndex(args, 1); - NSString *arg_aNullableString = GetNullableObjectAtIndex(args, 2); - [api callFlutterSendMultipleNullableTypesABool:arg_aNullableBool - anInt:arg_aNullableInt - aString:arg_aNullableString - completion:^(FLTAllNullableTypes *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi." - @"callFlutterEchoAllNullableTypesWithoutRecursion", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector - (callFlutterEchoAllNullableTypesWithoutRecursion:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoAllNullableTypesWithoutRecursion:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAllNullableTypesWithoutRecursion *arg_everything = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoAllNullableTypesWithoutRecursion:arg_everything - completion:^(FLTAllNullableTypesWithoutRecursion - *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi." - @"callFlutterSendMultipleNullableTypesWithoutRecursion", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert( - [api respondsToSelector:@selector - (callFlutterSendMultipleNullableTypesWithoutRecursionABool: - anInt:aString:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterSendMultipleNullableTypesWithoutRecursionABool:anInt:aString:" - @"completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_aNullableBool = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_aNullableInt = GetNullableObjectAtIndex(args, 1); - NSString *arg_aNullableString = GetNullableObjectAtIndex(args, 2); - [api callFlutterSendMultipleNullableTypesWithoutRecursionABool:arg_aNullableBool - anInt:arg_aNullableInt - aString:arg_aNullableString - completion:^( - FLTAllNullableTypesWithoutRecursion - *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoBool", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoBool:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoBool:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - BOOL arg_aBool = [GetNullableObjectAtIndex(args, 0) boolValue]; - [api callFlutterEchoBool:arg_aBool - completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoInt", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoInt:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoInt:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSInteger arg_anInt = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api callFlutterEchoInt:arg_anInt - completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoDouble", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoDouble:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoDouble:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - double arg_aDouble = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api callFlutterEchoDouble:arg_aDouble - completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoString", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoString:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoString:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_aString = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoString:arg_aString - completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoUint8List", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoUint8List:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoUint8List:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FlutterStandardTypedData *arg_list = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoUint8List:arg_list - completion:^(FlutterStandardTypedData *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoList:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_list = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoList:arg_list - completion:^(NSArray *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoEnumList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoEnumList:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoEnumList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_enumList = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoEnumList:arg_enumList - completion:^(NSArray *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoClassList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoClassList:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoClassList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_classList = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoClassList:arg_classList - completion:^(NSArray *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNonNullEnumList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNonNullEnumList:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNonNullEnumList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_enumList = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNonNullEnumList:arg_enumList - completion:^(NSArray *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNonNullClassList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNonNullClassList:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNonNullClassList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_classList = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNonNullClassList:arg_classList - completion:^(NSArray *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_map = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoMap:arg_map - completion:^(NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoStringMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoStringMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoStringMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_stringMap = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoStringMap:arg_stringMap - completion:^(NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoIntMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoIntMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoIntMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_intMap = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoIntMap:arg_intMap - completion:^(NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoEnumMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoEnumMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoEnumMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_enumMap = - GetNullableObjectAtIndex(args, 0); - [api - callFlutterEchoEnumMap:arg_enumMap - completion:^(NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoClassMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoClassMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoClassMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_classMap = - GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoClassMap:arg_classMap - completion:^( - NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNonNullStringMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNonNullStringMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNonNullStringMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_stringMap = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNonNullStringMap:arg_stringMap - completion:^( - NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNonNullIntMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNonNullIntMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNonNullIntMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_intMap = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNonNullIntMap:arg_intMap - completion:^(NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNonNullEnumMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNonNullEnumMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNonNullEnumMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_enumMap = - GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNonNullEnumMap:arg_enumMap - completion:^( - NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNonNullClassMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNonNullClassMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNonNullClassMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_classMap = - GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNonNullClassMap:arg_classMap - completion:^(NSDictionary - *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoEnum", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoEnum:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoEnum:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAnEnumBox *boxedFLTAnEnum = GetNullableObjectAtIndex(args, 0); - FLTAnEnum arg_anEnum = boxedFLTAnEnum.value; - [api callFlutterEchoEnum:arg_anEnum - completion:^(FLTAnEnumBox *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoAnotherEnum", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoAnotherEnum:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoAnotherEnum:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAnotherEnumBox *boxedFLTAnotherEnum = GetNullableObjectAtIndex(args, 0); - FLTAnotherEnum arg_anotherEnum = boxedFLTAnotherEnum.value; - [api callFlutterEchoAnotherEnum:arg_anotherEnum - completion:^(FLTAnotherEnumBox *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableBool", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableBool:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableBool:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_aBool = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableBool:arg_aBool - completion:^(NSNumber *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableInt", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableInt:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableInt:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_anInt = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableInt:arg_anInt - completion:^(NSNumber *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableDouble", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableDouble:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableDouble:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSNumber *arg_aDouble = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableDouble:arg_aDouble - completion:^(NSNumber *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableString", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableString:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableString:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_aString = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableString:arg_aString - completion:^(NSString *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableUint8List", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableUint8List:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableUint8List:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FlutterStandardTypedData *arg_list = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableUint8List:arg_list - completion:^(FlutterStandardTypedData *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableList:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_list = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableList:arg_list - completion:^(NSArray *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableEnumList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableEnumList:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableEnumList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_enumList = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableEnumList:arg_enumList - completion:^(NSArray *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableClassList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableClassList:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableClassList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_classList = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableClassList:arg_classList - completion:^(NSArray *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableNonNullEnumList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableNonNullEnumList: - completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableNonNullEnumList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_enumList = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableNonNullEnumList:arg_enumList - completion:^(NSArray *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableNonNullClassList", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableNonNullClassList: - completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableNonNullClassList:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSArray *arg_classList = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableNonNullClassList:arg_classList - completion:^( - NSArray *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_map = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableMap:arg_map - completion:^(NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableStringMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableStringMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableStringMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_stringMap = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableStringMap:arg_stringMap - completion:^( - NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableIntMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableIntMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableIntMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_intMap = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableIntMap:arg_intMap - completion:^(NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableEnumMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableEnumMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableEnumMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_enumMap = - GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableEnumMap:arg_enumMap - completion:^( - NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableClassMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableClassMap:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableClassMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_classMap = - GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableClassMap:arg_classMap - completion:^(NSDictionary - *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableNonNullStringMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableNonNullStringMap: - completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableNonNullStringMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_stringMap = GetNullableObjectAtIndex(args, 0); - [api - callFlutterEchoNullableNonNullStringMap:arg_stringMap - completion:^( - NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableNonNullIntMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableNonNullIntMap: - completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableNonNullIntMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_intMap = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableNonNullIntMap:arg_intMap - completion:^( - NSDictionary *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableNonNullEnumMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableNonNullEnumMap: - completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableNonNullEnumMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_enumMap = - GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableNonNullEnumMap:arg_enumMap - completion:^(NSDictionary - *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableNonNullClassMap", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableNonNullClassMap: - completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableNonNullClassMap:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSDictionary *arg_classMap = - GetNullableObjectAtIndex(args, 0); - [api - callFlutterEchoNullableNonNullClassMap:arg_classMap - completion:^(NSDictionary - *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoNullableEnum", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoNullableEnum:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoNullableEnum:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAnEnumBox *arg_anEnum = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoNullableEnum:arg_anEnum - completion:^(FLTAnEnumBox *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterEchoAnotherNullableEnum", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterEchoAnotherNullableEnum:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterEchoAnotherNullableEnum:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FLTAnotherEnumBox *arg_anotherEnum = GetNullableObjectAtIndex(args, 0); - [api callFlutterEchoAnotherNullableEnum:arg_anotherEnum - completion:^(FLTAnotherEnumBox *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostIntegrationCoreApi.callFlutterSmallApiEchoString", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(callFlutterSmallApiEchoString:completion:)], - @"FLTHostIntegrationCoreApi api (%@) doesn't respond to " - @"@selector(callFlutterSmallApiEchoString:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_aString = GetNullableObjectAtIndex(args, 0); - [api callFlutterSmallApiEchoString:arg_aString - completion:^(NSString *_Nullable output, - FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } -} -@interface FLTFlutterIntegrationCoreApi () -@property(nonatomic, strong) NSObject *binaryMessenger; -@property(nonatomic, strong) NSString *messageChannelSuffix; -@end - -@implementation FLTFlutterIntegrationCoreApi - -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { - return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; -} -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix { - self = [self init]; - if (self) { - _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 - ? @"" - : [NSString stringWithFormat:@".%@", messageChannelSuffix]; - } - return self; -} -- (void)noopWithCompletion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:nil - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; -} -- (void)throwErrorWithCompletion:(void (^)(id _Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:nil - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - id output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)throwErrorFromVoidWithCompletion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.throwErrorFromVoid", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:nil - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; -} -- (void)echoAllTypes:(FLTAllTypes *)arg_everything - completion:(void (^)(FLTAllTypes *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_everything ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - FLTAllTypes *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoAllNullableTypes:(nullable FLTAllNullableTypes *)arg_everything - completion:(void (^)(FLTAllNullableTypes *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoAllNullableTypes", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_everything ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - FLTAllNullableTypes *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)sendMultipleNullableTypesABool:(nullable NSNumber *)arg_aNullableBool - anInt:(nullable NSNumber *)arg_aNullableInt - aString:(nullable NSString *)arg_aNullableString - completion:(void (^)(FLTAllNullableTypes *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.sendMultipleNullableTypes", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ - arg_aNullableBool ?: [NSNull null], arg_aNullableInt ?: [NSNull null], - arg_aNullableString ?: [NSNull null] - ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - FLTAllNullableTypes *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoAllNullableTypesWithoutRecursion: - (nullable FLTAllNullableTypesWithoutRecursion *)arg_everything - completion: - (void (^)(FLTAllNullableTypesWithoutRecursion *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoAllNullableTypesWithoutRecursion", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_everything ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - FLTAllNullableTypesWithoutRecursion *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)sendMultipleNullableTypesWithoutRecursionABool:(nullable NSNumber *)arg_aNullableBool - anInt:(nullable NSNumber *)arg_aNullableInt - aString:(nullable NSString *)arg_aNullableString - completion: - (void (^)( - FLTAllNullableTypesWithoutRecursion *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi." - @"sendMultipleNullableTypesWithoutRecursion", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ - arg_aNullableBool ?: [NSNull null], arg_aNullableInt ?: [NSNull null], - arg_aNullableString ?: [NSNull null] - ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - FLTAllNullableTypesWithoutRecursion *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoBool:(BOOL)arg_aBool - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ @(arg_aBool) ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSNumber *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoInt:(NSInteger)arg_anInt - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ @(arg_anInt) ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSNumber *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoDouble:(double)arg_aDouble - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ @(arg_aDouble) ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSNumber *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoString:(NSString *)arg_aString - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_aString ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSString *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoUint8List:(FlutterStandardTypedData *)arg_list - completion: - (void (^)(FlutterStandardTypedData *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_list ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - FlutterStandardTypedData *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoList:(NSArray *)arg_list - completion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_list ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSArray *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoEnumList:(NSArray *)arg_enumList - completion: - (void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnumList", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_enumList ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSArray *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoClassList:(NSArray *)arg_classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoClassList", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_classList ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSArray *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNonNullEnumList:(NSArray *)arg_enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNonNullEnumList", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_enumList ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSArray *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNonNullClassList:(NSArray *)arg_classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNonNullClassList", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_classList ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSArray *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoMap:(NSDictionary *)arg_map - completion:(void (^)(NSDictionary *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_map ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoStringMap:(NSDictionary *)arg_stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoStringMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_stringMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoIntMap:(NSDictionary *)arg_intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoIntMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_intMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoEnumMap:(NSDictionary *)arg_enumMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnumMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_enumMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoClassMap:(NSDictionary *)arg_classMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoClassMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_classMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNonNullStringMap:(NSDictionary *)arg_stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNonNullStringMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_stringMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNonNullIntMap:(NSDictionary *)arg_intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNonNullIntMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_intMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNonNullEnumMap:(NSDictionary *)arg_enumMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNonNullEnumMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_enumMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNonNullClassMap:(NSDictionary *)arg_classMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNonNullClassMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_classMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoEnum:(FLTAnEnum)arg_anEnum - completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ [[FLTAnEnumBox alloc] initWithValue:arg_anEnum] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - FLTAnEnumBox *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoAnotherEnum:(FLTAnotherEnum)arg_anotherEnum - completion: - (void (^)(FLTAnotherEnumBox *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherEnum", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ [[FLTAnotherEnumBox alloc] initWithValue:arg_anotherEnum] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - FLTAnotherEnumBox *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableBool:(nullable NSNumber *)arg_aBool - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_aBool ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSNumber *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableInt:(nullable NSNumber *)arg_anInt - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_anInt ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSNumber *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableDouble:(nullable NSNumber *)arg_aDouble - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNullableDouble", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_aDouble ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSNumber *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableString:(nullable NSString *)arg_aString - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNullableString", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_aString ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSString *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableUint8List:(nullable FlutterStandardTypedData *)arg_list - completion:(void (^)(FlutterStandardTypedData *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNullableUint8List", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_list ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - FlutterStandardTypedData *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableList:(nullable NSArray *)arg_list - completion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_list ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSArray *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableEnumList:(nullable NSArray *)arg_enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNullableEnumList", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_enumList ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSArray *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableClassList:(nullable NSArray *)arg_classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNullableClassList", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_classList ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSArray *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableNonNullEnumList:(nullable NSArray *)arg_enumList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNullableNonNullEnumList", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_enumList ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSArray *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableNonNullClassList:(nullable NSArray *)arg_classList - completion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNullableNonNullClassList", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_classList ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSArray *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableMap:(nullable NSDictionary *)arg_map - completion: - (void (^)(NSDictionary *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_map ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableStringMap:(nullable NSDictionary *)arg_stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNullableStringMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_stringMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableIntMap:(nullable NSDictionary *)arg_intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNullableIntMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_intMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableEnumMap:(nullable NSDictionary *)arg_enumMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNullableEnumMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_enumMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableClassMap: - (nullable NSDictionary *)arg_classMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNullableClassMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_classMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableNonNullStringMap:(nullable NSDictionary *)arg_stringMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNullableNonNullStringMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_stringMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableNonNullIntMap:(nullable NSDictionary *)arg_intMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNullableNonNullIntMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_intMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void) - echoNullableNonNullEnumMap:(nullable NSDictionary *)arg_enumMap - completion:(void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNullableNonNullEnumMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_enumMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableNonNullClassMap: - (nullable NSDictionary *)arg_classMap - completion: - (void (^)(NSDictionary *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoNullableNonNullClassMap", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_classMap ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSDictionary *output = - reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoNullableEnum:(nullable FLTAnEnumBox *)arg_anEnum - completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_anEnum == nil ? [NSNull null] : arg_anEnum ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - FLTAnEnumBox *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoAnotherNullableEnum:(nullable FLTAnotherEnumBox *)arg_anotherEnum - completion:(void (^)(FLTAnotherEnumBox *_Nullable, - FlutterError *_Nullable))completion { - NSString *channelName = - [NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"FlutterIntegrationCoreApi.echoAnotherNullableEnum", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_anotherEnum == nil ? [NSNull null] : arg_anotherEnum ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - FLTAnotherEnumBox *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)noopAsyncWithCompletion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:nil - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; -} -- (void)echoAsyncString:(NSString *)arg_aString - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_aString ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSString *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -@end - -void SetUpFLTHostTrivialApi(id binaryMessenger, - NSObject *api) { - SetUpFLTHostTrivialApiWithSuffix(binaryMessenger, api, @""); -} - -void SetUpFLTHostTrivialApiWithSuffix(id binaryMessenger, - NSObject *api, - NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(noopWithError:)], - @"FLTHostTrivialApi api (%@) doesn't respond to @selector(noopWithError:)", api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - FlutterError *error; - [api noopWithError:&error]; - callback(wrapResult(nil, error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } -} -void SetUpFLTHostSmallApi(id binaryMessenger, - NSObject *api) { - SetUpFLTHostSmallApiWithSuffix(binaryMessenger, api, @""); -} - -void SetUpFLTHostSmallApiWithSuffix(id binaryMessenger, - NSObject *api, - NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(echoString:completion:)], - @"FLTHostSmallApi api (%@) doesn't respond to @selector(echoString:completion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - NSString *arg_aString = GetNullableObjectAtIndex(args, 0); - [api echoString:arg_aString - completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests." - @"HostSmallApi.voidVoid", - messageChannelSuffix] - binaryMessenger:binaryMessenger - codec:FLTGetCoreTestsCodec()]; - if (api) { - NSCAssert([api respondsToSelector:@selector(voidVoidWithCompletion:)], - @"FLTHostSmallApi api (%@) doesn't respond to @selector(voidVoidWithCompletion:)", - api); - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api voidVoidWithCompletion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } -} -@interface FLTFlutterSmallApi () -@property(nonatomic, strong) NSObject *binaryMessenger; -@property(nonatomic, strong) NSString *messageChannelSuffix; -@end - -@implementation FLTFlutterSmallApi - -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { - return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; -} -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix { - self = [self init]; - if (self) { - _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 - ? @"" - : [NSString stringWithFormat:@".%@", messageChannelSuffix]; - } - return self; -} -- (void)echoWrappedList:(FLTTestMessage *)arg_msg - completion:(void (^)(FLTTestMessage *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", @"dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_msg ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - FLTTestMessage *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -- (void)echoString:(NSString *)arg_aString - completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString", - _messageChannelSuffix]; - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FLTGetCoreTestsCodec()]; - [channel sendMessage:@[ arg_aString ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion(nil, [FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - NSString *output = reply[0] == [NSNull null] ? nil : reply[0]; - completion(output, nil); - } - } else { - completion(nil, createConnectionError(channelName)); - } - }]; -} -@end diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/alternate_language_test_plugin.podspec b/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/alternate_language_test_plugin.podspec deleted file mode 100644 index d9ce18f4dab..00000000000 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/macos/alternate_language_test_plugin.podspec +++ /dev/null @@ -1,23 +0,0 @@ -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. -# Run `pod lib lint alternate_language_test_plugin.podspec` to validate before publishing. -# -Pod::Spec.new do |s| - s.name = 'alternate_language_test_plugin' - s.version = '0.0.1' - s.summary = 'Alternate-language Pigeon test plugin' - s.description = <<-DESC -A plugin to test Pigeon generation for secondary languages (e.g., Java, Objective-C). - DESC - s.homepage = 'http://example.com' - s.license = { :type => 'BSD', :file => '../../../LICENSE' } - s.author = { 'Your Company' => 'email@example.com' } - - s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/pigeon' } - s.source_files = 'Classes/**/*' - s.dependency 'FlutterMacOS' - - s.platform = :osx, '10.14' - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } - s.swift_version = '5.0' -end diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/pubspec.yaml b/packages/pigeon/platform_tests/alternate_language_test_plugin/pubspec.yaml index 415203428d8..14ece47a315 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/pubspec.yaml +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/pubspec.yaml @@ -15,8 +15,10 @@ flutter: pluginClass: AlternateLanguageTestPlugin ios: pluginClass: AlternateLanguageTestPlugin + sharedDarwinSource: true macos: pluginClass: AlternateLanguageTestPlugin + sharedDarwinSource: true dependencies: flutter: diff --git a/packages/pigeon/platform_tests/test_plugin/android/build.gradle b/packages/pigeon/platform_tests/test_plugin/android/build.gradle index 2789471f520..1732a4ddffe 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/build.gradle +++ b/packages/pigeon/platform_tests/test_plugin/android/build.gradle @@ -43,7 +43,7 @@ android { } defaultConfig { - minSdkVersion 19 + minSdkVersion 21 } testOptions { @@ -65,7 +65,7 @@ android { } dependencies { - testImplementation 'junit:junit:4.+' + testImplementation 'junit:junit:4.13.2' testImplementation "io.mockk:mockk:1.13.16" // org.jetbrains.kotlin:kotlin-bom artifact purpose is to align kotlin stdlib and related code versions. // See: https://youtrack.jetbrains.com/issue/KT-55297/kotlin-stdlib-should-declare-constraints-on-kotlin-stdlib-jdk8-and-kotlin-stdlib-jdk7 diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt index a4da07d66a6..59187acc592 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt @@ -16,24 +16,53 @@ import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer -private fun wrapResult(result: Any?): List { - return listOf(result) -} +private object CoreTestsPigeonUtils { -private fun wrapError(exception: Throwable): List { - return if (exception is FlutterError) { - listOf(exception.code, exception.message, exception.details) - } else { - listOf( - exception.javaClass.simpleName, - exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + fun createConnectionError(channelName: String): FlutterError { + return FlutterError( + "channel-error", "Unable to establish connection on channel: '$channelName'.", "") + } + + fun wrapResult(result: Any?): List { + return listOf(result) + } + + fun wrapError(exception: Throwable): List { + return if (exception is FlutterError) { + listOf(exception.code, exception.message, exception.details) + } else { + listOf( + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + } } -} -private fun createConnectionError(channelName: String): FlutterError { - return FlutterError( - "channel-error", "Unable to establish connection on channel: '$channelName'.", "") + fun deepEquals(a: Any?, b: Any?): Boolean { + if (a is ByteArray && b is ByteArray) { + return a.contentEquals(b) + } + if (a is IntArray && b is IntArray) { + return a.contentEquals(b) + } + if (a is LongArray && b is LongArray) { + return a.contentEquals(b) + } + if (a is DoubleArray && b is DoubleArray) { + return a.contentEquals(b) + } + if (a is Array<*> && b is Array<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is List<*> && b is List<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is Map<*, *> && b is Map<*, *>) { + return a.size == b.size && + a.all { (b as Map).containsKey(it.key) && deepEquals(it.value, b[it.key]) } + } + return a == b + } } /** @@ -49,34 +78,6 @@ class FlutterError( val details: Any? = null ) : Throwable() -private fun deepEqualsCoreTests(a: Any?, b: Any?): Boolean { - if (a is ByteArray && b is ByteArray) { - return a.contentEquals(b) - } - if (a is IntArray && b is IntArray) { - return a.contentEquals(b) - } - if (a is LongArray && b is LongArray) { - return a.contentEquals(b) - } - if (a is DoubleArray && b is DoubleArray) { - return a.contentEquals(b) - } - if (a is Array<*> && b is Array<*>) { - return a.size == b.size && a.indices.all { deepEqualsCoreTests(a[it], b[it]) } - } - if (a is List<*> && b is List<*>) { - return a.size == b.size && a.indices.all { deepEqualsCoreTests(a[it], b[it]) } - } - if (a is Map<*, *> && b is Map<*, *>) { - return a.size == b.size && - a.all { - (b as Map).containsKey(it.key) && deepEqualsCoreTests(it.value, b[it.key]) - } - } - return a == b -} - enum class AnEnum(val raw: Int) { ONE(0), TWO(1), @@ -123,7 +124,7 @@ data class UnusedClass(val aField: Any? = null) { if (this === other) { return true } - return deepEqualsCoreTests(toList(), other.toList()) + return CoreTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -266,7 +267,7 @@ data class AllTypes( if (this === other) { return true } - return deepEqualsCoreTests(toList(), other.toList()) + return CoreTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -421,7 +422,7 @@ data class AllNullableTypes( if (this === other) { return true } - return deepEqualsCoreTests(toList(), other.toList()) + return CoreTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -565,7 +566,7 @@ data class AllNullableTypesWithoutRecursion( if (this === other) { return true } - return deepEqualsCoreTests(toList(), other.toList()) + return CoreTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -628,7 +629,7 @@ data class AllClassesWrapper( if (this === other) { return true } - return deepEqualsCoreTests(toList(), other.toList()) + return CoreTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -660,7 +661,7 @@ data class TestMessage(val testList: List? = null) { if (this === other) { return true } - return deepEqualsCoreTests(toList(), other.toList()) + return CoreTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -1236,7 +1237,7 @@ interface HostIntegrationCoreApi { api.noop() listOf(null) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1258,7 +1259,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoAllTypes(everythingArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1278,7 +1279,7 @@ interface HostIntegrationCoreApi { try { listOf(api.throwError()) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1299,7 +1300,7 @@ interface HostIntegrationCoreApi { api.throwErrorFromVoid() listOf(null) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1319,7 +1320,7 @@ interface HostIntegrationCoreApi { try { listOf(api.throwFlutterError()) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1341,7 +1342,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoInt(anIntArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1363,7 +1364,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoDouble(aDoubleArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1385,7 +1386,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoBool(aBoolArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1407,7 +1408,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoString(aStringArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1429,7 +1430,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoUint8List(aUint8ListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1451,7 +1452,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoObject(anObjectArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1473,7 +1474,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoList(listArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1495,7 +1496,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoEnumList(enumListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1517,7 +1518,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoClassList(classListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1539,7 +1540,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNonNullEnumList(enumListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1561,7 +1562,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNonNullClassList(classListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1583,7 +1584,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoMap(mapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1605,7 +1606,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoStringMap(stringMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1627,7 +1628,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoIntMap(intMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1649,7 +1650,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoEnumMap(enumMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1671,7 +1672,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoClassMap(classMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1693,7 +1694,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNonNullStringMap(stringMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1715,7 +1716,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNonNullIntMap(intMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1737,7 +1738,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNonNullEnumMap(enumMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1759,7 +1760,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNonNullClassMap(classMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1781,7 +1782,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoClassWrapper(wrapperArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1803,7 +1804,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoEnum(anEnumArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1825,7 +1826,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoAnotherEnum(anotherEnumArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1847,7 +1848,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNamedDefaultString(aStringArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1869,7 +1870,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoOptionalDefaultDouble(aDoubleArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1891,7 +1892,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoRequiredInt(anIntArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1913,7 +1914,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoAllNullableTypes(everythingArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1935,7 +1936,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoAllNullableTypesWithoutRecursion(everythingArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1957,7 +1958,7 @@ interface HostIntegrationCoreApi { try { listOf(api.extractNestedNullableString(wrapperArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1979,7 +1980,7 @@ interface HostIntegrationCoreApi { try { listOf(api.createNestedNullableString(nullableStringArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2005,7 +2006,7 @@ interface HostIntegrationCoreApi { api.sendMultipleNullableTypes( aNullableBoolArg, aNullableIntArg, aNullableStringArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2031,7 +2032,7 @@ interface HostIntegrationCoreApi { api.sendMultipleNullableTypesWithoutRecursion( aNullableBoolArg, aNullableIntArg, aNullableStringArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2053,7 +2054,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableInt(aNullableIntArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2075,7 +2076,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableDouble(aNullableDoubleArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2097,7 +2098,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableBool(aNullableBoolArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2119,7 +2120,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableString(aNullableStringArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2141,7 +2142,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableUint8List(aNullableUint8ListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2163,7 +2164,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableObject(aNullableObjectArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2185,7 +2186,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableList(aNullableListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2207,7 +2208,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableEnumList(enumListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2229,7 +2230,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableClassList(classListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2251,7 +2252,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableNonNullEnumList(enumListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2273,7 +2274,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableNonNullClassList(classListArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2295,7 +2296,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableMap(mapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2317,7 +2318,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableStringMap(stringMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2339,7 +2340,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableIntMap(intMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2361,7 +2362,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableEnumMap(enumMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2383,7 +2384,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableClassMap(classMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2405,7 +2406,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableNonNullStringMap(stringMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2427,7 +2428,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableNonNullIntMap(intMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2449,7 +2450,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableNonNullEnumMap(enumMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2471,7 +2472,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableNonNullClassMap(classMapArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2493,7 +2494,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNullableEnum(anEnumArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2515,7 +2516,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoAnotherNullableEnum(anotherEnumArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2537,7 +2538,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoOptionalNullableInt(aNullableIntArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2559,7 +2560,7 @@ interface HostIntegrationCoreApi { try { listOf(api.echoNamedNullableString(aNullableStringArg)) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2578,9 +2579,9 @@ interface HostIntegrationCoreApi { api.noopAsync { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(CoreTestsPigeonUtils.wrapResult(null)) } } } @@ -2601,10 +2602,10 @@ interface HostIntegrationCoreApi { api.echoAsyncInt(anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2625,10 +2626,10 @@ interface HostIntegrationCoreApi { api.echoAsyncDouble(aDoubleArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2649,10 +2650,10 @@ interface HostIntegrationCoreApi { api.echoAsyncBool(aBoolArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2673,10 +2674,10 @@ interface HostIntegrationCoreApi { api.echoAsyncString(aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2697,10 +2698,10 @@ interface HostIntegrationCoreApi { api.echoAsyncUint8List(aUint8ListArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2721,10 +2722,10 @@ interface HostIntegrationCoreApi { api.echoAsyncObject(anObjectArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2745,10 +2746,10 @@ interface HostIntegrationCoreApi { api.echoAsyncList(listArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2769,10 +2770,10 @@ interface HostIntegrationCoreApi { api.echoAsyncEnumList(enumListArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2793,10 +2794,10 @@ interface HostIntegrationCoreApi { api.echoAsyncClassList(classListArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2817,10 +2818,10 @@ interface HostIntegrationCoreApi { api.echoAsyncMap(mapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2841,10 +2842,10 @@ interface HostIntegrationCoreApi { api.echoAsyncStringMap(stringMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2865,10 +2866,10 @@ interface HostIntegrationCoreApi { api.echoAsyncIntMap(intMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2889,10 +2890,10 @@ interface HostIntegrationCoreApi { api.echoAsyncEnumMap(enumMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2913,10 +2914,10 @@ interface HostIntegrationCoreApi { api.echoAsyncClassMap(classMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2937,10 +2938,10 @@ interface HostIntegrationCoreApi { api.echoAsyncEnum(anEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2961,10 +2962,10 @@ interface HostIntegrationCoreApi { api.echoAnotherAsyncEnum(anotherEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -2983,10 +2984,10 @@ interface HostIntegrationCoreApi { api.throwAsyncError { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3005,9 +3006,9 @@ interface HostIntegrationCoreApi { api.throwAsyncErrorFromVoid { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(CoreTestsPigeonUtils.wrapResult(null)) } } } @@ -3026,10 +3027,10 @@ interface HostIntegrationCoreApi { api.throwAsyncFlutterError { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3050,10 +3051,10 @@ interface HostIntegrationCoreApi { api.echoAsyncAllTypes(everythingArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3075,10 +3076,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3100,10 +3101,10 @@ interface HostIntegrationCoreApi { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3124,10 +3125,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableInt(anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3148,10 +3149,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableDouble(aDoubleArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3172,10 +3173,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableBool(aBoolArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3196,10 +3197,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableString(aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3220,10 +3221,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableUint8List(aUint8ListArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3244,10 +3245,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableObject(anObjectArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3268,10 +3269,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableList(listArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3292,10 +3293,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableEnumList(enumListArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3317,10 +3318,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3341,10 +3342,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableMap(mapArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3365,10 +3366,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableStringMap(stringMapArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3389,10 +3390,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableIntMap(intMapArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3413,10 +3414,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableEnumMap(enumMapArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3438,10 +3439,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3462,10 +3463,10 @@ interface HostIntegrationCoreApi { api.echoAsyncNullableEnum(anEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3486,10 +3487,10 @@ interface HostIntegrationCoreApi { api.echoAnotherAsyncNullableEnum(anotherEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3509,7 +3510,7 @@ interface HostIntegrationCoreApi { try { listOf(api.defaultIsMainThread()) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -3530,7 +3531,7 @@ interface HostIntegrationCoreApi { try { listOf(api.taskQueueIsBackgroundThread()) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -3549,9 +3550,9 @@ interface HostIntegrationCoreApi { api.callFlutterNoop { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(CoreTestsPigeonUtils.wrapResult(null)) } } } @@ -3570,10 +3571,10 @@ interface HostIntegrationCoreApi { api.callFlutterThrowError { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3592,9 +3593,9 @@ interface HostIntegrationCoreApi { api.callFlutterThrowErrorFromVoid { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(CoreTestsPigeonUtils.wrapResult(null)) } } } @@ -3615,10 +3616,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoAllTypes(everythingArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3640,10 +3641,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3668,10 +3669,10 @@ interface HostIntegrationCoreApi { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3693,10 +3694,10 @@ interface HostIntegrationCoreApi { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3721,10 +3722,10 @@ interface HostIntegrationCoreApi { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3745,10 +3746,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoBool(aBoolArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3769,10 +3770,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoInt(anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3793,10 +3794,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoDouble(aDoubleArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3817,10 +3818,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoString(aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3841,10 +3842,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoUint8List(listArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3865,10 +3866,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoList(listArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3889,10 +3890,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoEnumList(enumListArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3913,10 +3914,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoClassList(classListArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3937,10 +3938,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNonNullEnumList(enumListArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3962,10 +3963,10 @@ interface HostIntegrationCoreApi { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -3986,10 +3987,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoMap(mapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4010,10 +4011,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoStringMap(stringMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4034,10 +4035,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoIntMap(intMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4058,10 +4059,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoEnumMap(enumMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4083,10 +4084,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4108,10 +4109,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4132,10 +4133,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNonNullIntMap(intMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4156,10 +4157,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNonNullEnumMap(enumMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4181,10 +4182,10 @@ interface HostIntegrationCoreApi { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4205,10 +4206,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoEnum(anEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4229,10 +4230,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoAnotherEnum(anotherEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4253,10 +4254,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableBool(aBoolArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4277,10 +4278,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableInt(anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4301,10 +4302,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableDouble(aDoubleArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4325,10 +4326,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableString(aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4349,10 +4350,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableUint8List(listArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4373,10 +4374,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableList(listArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4397,10 +4398,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableEnumList(enumListArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4422,10 +4423,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4447,10 +4448,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4472,10 +4473,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4496,10 +4497,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableMap(mapArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4521,10 +4522,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4545,10 +4546,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableIntMap(intMapArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4570,10 +4571,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4595,10 +4596,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4620,10 +4621,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4645,10 +4646,10 @@ interface HostIntegrationCoreApi { -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4670,10 +4671,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4695,10 +4696,10 @@ interface HostIntegrationCoreApi { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4719,10 +4720,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoNullableEnum(anEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4743,10 +4744,10 @@ interface HostIntegrationCoreApi { api.callFlutterEchoAnotherNullableEnum(anotherEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4767,10 +4768,10 @@ interface HostIntegrationCoreApi { api.callFlutterSmallApiEchoString(aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -4810,7 +4811,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4830,7 +4831,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4849,7 +4850,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4876,7 +4877,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4899,7 +4900,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4935,7 +4936,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4958,7 +4959,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4994,7 +4995,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5021,7 +5022,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5048,7 +5049,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5075,7 +5076,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5102,7 +5103,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5129,7 +5130,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5156,7 +5157,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5183,7 +5184,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5213,7 +5214,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5240,7 +5241,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5270,7 +5271,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5297,7 +5298,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5327,7 +5328,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5354,7 +5355,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5384,7 +5385,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5414,7 +5415,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5444,7 +5445,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5471,7 +5472,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5501,7 +5502,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5531,7 +5532,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5558,7 +5559,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5585,7 +5586,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5605,7 +5606,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5625,7 +5626,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5645,7 +5646,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5665,7 +5666,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5685,7 +5686,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5705,7 +5706,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5728,7 +5729,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5751,7 +5752,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5774,7 +5775,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5797,7 +5798,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5817,7 +5818,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5840,7 +5841,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5863,7 +5864,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5886,7 +5887,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5909,7 +5910,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5932,7 +5933,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5955,7 +5956,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -5978,7 +5979,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -6001,7 +6002,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -6021,7 +6022,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -6044,7 +6045,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -6066,7 +6067,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -6093,7 +6094,7 @@ class FlutterIntegrationCoreApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -6131,7 +6132,7 @@ interface HostTrivialApi { api.noop() listOf(null) } catch (exception: Throwable) { - wrapError(exception) + CoreTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -6177,10 +6178,10 @@ interface HostSmallApi { api.echo(aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(CoreTestsPigeonUtils.wrapResult(data)) } } } @@ -6199,9 +6200,9 @@ interface HostSmallApi { api.voidVoid { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(CoreTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(CoreTestsPigeonUtils.wrapResult(null)) } } } @@ -6248,7 +6249,7 @@ class FlutterSmallApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -6275,7 +6276,7 @@ class FlutterSmallApi( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(CoreTestsPigeonUtils.createConnectionError(channelName))) } } } diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/EventChannelTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/EventChannelTests.gen.kt index 63f971e424a..dc0745c2896 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/EventChannelTests.gen.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/EventChannelTests.gen.kt @@ -15,6 +15,34 @@ import io.flutter.plugin.common.StandardMethodCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer +private object EventChannelTestsPigeonUtils { + fun deepEquals(a: Any?, b: Any?): Boolean { + if (a is ByteArray && b is ByteArray) { + return a.contentEquals(b) + } + if (a is IntArray && b is IntArray) { + return a.contentEquals(b) + } + if (a is LongArray && b is LongArray) { + return a.contentEquals(b) + } + if (a is DoubleArray && b is DoubleArray) { + return a.contentEquals(b) + } + if (a is Array<*> && b is Array<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is List<*> && b is List<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is Map<*, *> && b is Map<*, *>) { + return a.size == b.size && + a.all { (b as Map).containsKey(it.key) && deepEquals(it.value, b[it.key]) } + } + return a == b + } +} + /** * Error class for passing custom error details to Flutter via a thrown PlatformException. * @@ -28,35 +56,6 @@ class EventChannelTestsError( val details: Any? = null ) : Throwable() -private fun deepEqualsEventChannelTests(a: Any?, b: Any?): Boolean { - if (a is ByteArray && b is ByteArray) { - return a.contentEquals(b) - } - if (a is IntArray && b is IntArray) { - return a.contentEquals(b) - } - if (a is LongArray && b is LongArray) { - return a.contentEquals(b) - } - if (a is DoubleArray && b is DoubleArray) { - return a.contentEquals(b) - } - if (a is Array<*> && b is Array<*>) { - return a.size == b.size && a.indices.all { deepEqualsEventChannelTests(a[it], b[it]) } - } - if (a is List<*> && b is List<*>) { - return a.size == b.size && a.indices.all { deepEqualsEventChannelTests(a[it], b[it]) } - } - if (a is Map<*, *> && b is Map<*, *>) { - return a.size == b.size && - a.all { - (b as Map).containsKey(it.key) && - deepEqualsEventChannelTests(it.value, b[it.key]) - } - } - return a == b -} - enum class EventEnum(val raw: Int) { ONE(0), TWO(1), @@ -230,7 +229,7 @@ data class EventAllNullableTypes( if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -263,7 +262,7 @@ data class IntEvent(val value: Long) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -291,7 +290,7 @@ data class StringEvent(val value: String) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -319,7 +318,7 @@ data class BoolEvent(val value: Boolean) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -347,7 +346,7 @@ data class DoubleEvent(val value: Double) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -375,7 +374,7 @@ data class ObjectsEvent(val value: Any) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -403,7 +402,7 @@ data class EnumEvent(val value: EventEnum) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() @@ -431,7 +430,7 @@ data class ClassEvent(val value: EventAllNullableTypes) : PlatformEvent() { if (this === other) { return true } - return deepEqualsEventChannelTests(toList(), other.toList()) + return EventChannelTestsPigeonUtils.deepEquals(toList(), other.toList()) } override fun hashCode(): Int = toList().hashCode() diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/ProxyApiTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/ProxyApiTests.gen.kt index 88c43a433ea..3b1933827d6 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/ProxyApiTests.gen.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/ProxyApiTests.gen.kt @@ -16,24 +16,27 @@ import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer -private fun wrapResult(result: Any?): List { - return listOf(result) -} +private object ProxyApiTestsPigeonUtils { -private fun wrapError(exception: Throwable): List { - return if (exception is ProxyApiTestsError) { - listOf(exception.code, exception.message, exception.details) - } else { - listOf( - exception.javaClass.simpleName, - exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + fun createConnectionError(channelName: String): ProxyApiTestsError { + return ProxyApiTestsError( + "channel-error", "Unable to establish connection on channel: '$channelName'.", "") } -} -private fun createConnectionError(channelName: String): ProxyApiTestsError { - return ProxyApiTestsError( - "channel-error", "Unable to establish connection on channel: '$channelName'.", "") + fun wrapResult(result: Any?): List { + return listOf(result) + } + + fun wrapError(exception: Throwable): List { + return if (exception is ProxyApiTestsError) { + listOf(exception.code, exception.message, exception.details) + } else { + listOf( + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + } + } } /** @@ -78,6 +81,9 @@ class ProxyApiTestsPigeonInstanceManager( private val referenceQueue = java.lang.ref.ReferenceQueue() private val weakReferencesToIdentifiers = HashMap, Long>() private val handler = android.os.Handler(android.os.Looper.getMainLooper()) + private val releaseAllFinalizedInstancesRunnable = Runnable { + this.releaseAllFinalizedInstances() + } private var nextIdentifier: Long = minHostCreatedIdentifier private var hasFinalizationListenerStopped = false @@ -87,13 +93,13 @@ class ProxyApiTestsPigeonInstanceManager( */ var clearFinalizedWeakReferencesInterval: Long = 3000 set(value) { - handler.removeCallbacks { this.releaseAllFinalizedInstances() } + handler.removeCallbacks(releaseAllFinalizedInstancesRunnable) field = value releaseAllFinalizedInstances() } init { - handler.postDelayed({ releaseAllFinalizedInstances() }, clearFinalizedWeakReferencesInterval) + handler.postDelayed(releaseAllFinalizedInstancesRunnable, clearFinalizedWeakReferencesInterval) } companion object { @@ -162,7 +168,9 @@ class ProxyApiTestsPigeonInstanceManager( /** * Adds a new unique instance that was instantiated from the host platform. * - * [identifier] must be >= 0 and unique. + * If the manager contains [instance], this returns the corresponding identifier. If the manager + * does not contain [instance], this adds the instance and returns a unique identifier for that + * [instance]. */ fun addHostCreatedInstance(instance: Any): Long { logWarningIfFinalizationListenerHasStopped() @@ -195,7 +203,7 @@ class ProxyApiTestsPigeonInstanceManager( * longer be called and methods will log a warning. */ fun stopFinalizationListener() { - handler.removeCallbacks { this.releaseAllFinalizedInstances() } + handler.removeCallbacks(releaseAllFinalizedInstancesRunnable) hasFinalizationListenerStopped = true } @@ -235,7 +243,7 @@ class ProxyApiTestsPigeonInstanceManager( finalizationListener.onFinalize(identifier) } } - handler.postDelayed({ releaseAllFinalizedInstances() }, clearFinalizedWeakReferencesInterval) + handler.postDelayed(releaseAllFinalizedInstancesRunnable, clearFinalizedWeakReferencesInterval) } private fun addInstance(instance: Any, identifier: Long) { @@ -288,7 +296,7 @@ private class ProxyApiTestsPigeonInstanceManagerApi(val binaryMessenger: BinaryM instanceManager.remove(identifierArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -309,7 +317,7 @@ private class ProxyApiTestsPigeonInstanceManagerApi(val binaryMessenger: BinaryM instanceManager.clear() listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -334,7 +342,7 @@ private class ProxyApiTestsPigeonInstanceManagerApi(val binaryMessenger: BinaryM callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -1086,7 +1094,7 @@ abstract class PigeonApiProxyApiTestClass( pigeon_identifierArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1147,7 +1155,7 @@ abstract class PigeonApiProxyApiTestClass( pigeon_identifierArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1172,7 +1180,7 @@ abstract class PigeonApiProxyApiTestClass( api.attachedField(pigeon_instanceArg), pigeon_identifierArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1196,7 +1204,7 @@ abstract class PigeonApiProxyApiTestClass( api.staticAttachedField(), pigeon_identifierArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1219,7 +1227,7 @@ abstract class PigeonApiProxyApiTestClass( api.noop(pigeon_instanceArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1241,7 +1249,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.throwError(pigeon_instanceArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1264,7 +1272,7 @@ abstract class PigeonApiProxyApiTestClass( api.throwErrorFromVoid(pigeon_instanceArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1286,7 +1294,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.throwFlutterError(pigeon_instanceArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1309,7 +1317,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoInt(pigeon_instanceArg, anIntArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1332,7 +1340,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoDouble(pigeon_instanceArg, aDoubleArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1355,7 +1363,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoBool(pigeon_instanceArg, aBoolArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1378,7 +1386,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoString(pigeon_instanceArg, aStringArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1401,7 +1409,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoUint8List(pigeon_instanceArg, aUint8ListArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1424,7 +1432,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoObject(pigeon_instanceArg, anObjectArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1447,7 +1455,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoList(pigeon_instanceArg, aListArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1470,7 +1478,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoProxyApiList(pigeon_instanceArg, aListArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1493,7 +1501,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoMap(pigeon_instanceArg, aMapArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1516,7 +1524,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoProxyApiMap(pigeon_instanceArg, aMapArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1539,7 +1547,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoEnum(pigeon_instanceArg, anEnumArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1562,7 +1570,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoProxyApi(pigeon_instanceArg, aProxyApiArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1585,7 +1593,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableInt(pigeon_instanceArg, aNullableIntArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1608,7 +1616,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableDouble(pigeon_instanceArg, aNullableDoubleArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1631,7 +1639,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableBool(pigeon_instanceArg, aNullableBoolArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1654,7 +1662,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableString(pigeon_instanceArg, aNullableStringArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1677,7 +1685,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableUint8List(pigeon_instanceArg, aNullableUint8ListArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1700,7 +1708,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableObject(pigeon_instanceArg, aNullableObjectArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1723,7 +1731,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableList(pigeon_instanceArg, aNullableListArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1746,7 +1754,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableMap(pigeon_instanceArg, aNullableMapArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1769,7 +1777,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableEnum(pigeon_instanceArg, aNullableEnumArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1792,7 +1800,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoNullableProxyApi(pigeon_instanceArg, aNullableProxyApiArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -1813,9 +1821,9 @@ abstract class PigeonApiProxyApiTestClass( api.noopAsync(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(null)) } } } @@ -1837,10 +1845,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncInt(pigeon_instanceArg, anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -1862,10 +1870,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncDouble(pigeon_instanceArg, aDoubleArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -1887,10 +1895,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncBool(pigeon_instanceArg, aBoolArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -1912,10 +1920,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncString(pigeon_instanceArg, aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -1937,10 +1945,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncUint8List(pigeon_instanceArg, aUint8ListArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -1962,10 +1970,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncObject(pigeon_instanceArg, anObjectArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -1987,10 +1995,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncList(pigeon_instanceArg, aListArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2012,10 +2020,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncMap(pigeon_instanceArg, aMapArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2037,10 +2045,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncEnum(pigeon_instanceArg, anEnumArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2061,10 +2069,10 @@ abstract class PigeonApiProxyApiTestClass( api.throwAsyncError(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2085,9 +2093,9 @@ abstract class PigeonApiProxyApiTestClass( api.throwAsyncErrorFromVoid(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(null)) } } } @@ -2108,10 +2116,10 @@ abstract class PigeonApiProxyApiTestClass( api.throwAsyncFlutterError(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2133,10 +2141,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncNullableInt(pigeon_instanceArg, anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2158,10 +2166,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncNullableDouble(pigeon_instanceArg, aDoubleArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2183,10 +2191,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncNullableBool(pigeon_instanceArg, aBoolArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2208,10 +2216,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncNullableString(pigeon_instanceArg, aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2234,10 +2242,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2259,10 +2267,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncNullableObject(pigeon_instanceArg, anObjectArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2284,10 +2292,10 @@ abstract class PigeonApiProxyApiTestClass( api.echoAsyncNullableList(pigeon_instanceArg, aListArg) { result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2310,10 +2318,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2336,10 +2344,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2360,7 +2368,7 @@ abstract class PigeonApiProxyApiTestClass( api.staticNoop() listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2382,7 +2390,7 @@ abstract class PigeonApiProxyApiTestClass( try { listOf(api.echoStaticString(aStringArg)) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -2401,9 +2409,9 @@ abstract class PigeonApiProxyApiTestClass( api.staticAsyncNoop { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(null)) } } } @@ -2424,9 +2432,9 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterNoop(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(null)) } } } @@ -2447,10 +2455,10 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterThrowError(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2471,9 +2479,9 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterThrowErrorFromVoid(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(null)) } } } @@ -2495,10 +2503,10 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterEchoBool(pigeon_instanceArg, aBoolArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2520,10 +2528,10 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterEchoInt(pigeon_instanceArg, anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2545,10 +2553,10 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterEchoDouble(pigeon_instanceArg, aDoubleArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2570,10 +2578,10 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterEchoString(pigeon_instanceArg, aStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2596,10 +2604,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2621,10 +2629,10 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterEchoList(pigeon_instanceArg, aListArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2647,10 +2655,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2673,10 +2681,10 @@ abstract class PigeonApiProxyApiTestClass( -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2699,10 +2707,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2725,10 +2733,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2751,10 +2759,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2777,10 +2785,10 @@ abstract class PigeonApiProxyApiTestClass( -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2802,10 +2810,10 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterEchoNullableInt(pigeon_instanceArg, anIntArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2828,10 +2836,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2854,10 +2862,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2880,10 +2888,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2906,10 +2914,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2932,10 +2940,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result?> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2958,10 +2966,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -2984,10 +2992,10 @@ abstract class PigeonApiProxyApiTestClass( result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -3008,9 +3016,9 @@ abstract class PigeonApiProxyApiTestClass( api.callFlutterNoopAsync(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(null)) } } } @@ -3033,10 +3041,10 @@ abstract class PigeonApiProxyApiTestClass( -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(ProxyApiTestsPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(ProxyApiTestsPigeonUtils.wrapResult(data)) } } } @@ -3088,7 +3096,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3117,7 +3125,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3148,7 +3156,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3188,7 +3196,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3227,7 +3235,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3267,7 +3275,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3307,7 +3315,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3347,7 +3355,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3387,7 +3395,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3427,7 +3435,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3466,7 +3474,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3506,7 +3514,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3546,7 +3554,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3586,7 +3594,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3619,7 +3627,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3652,7 +3660,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3685,7 +3693,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3718,7 +3726,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3751,7 +3759,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3784,7 +3792,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3817,7 +3825,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3850,7 +3858,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3883,7 +3891,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3914,7 +3922,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -3954,7 +3962,7 @@ abstract class PigeonApiProxyApiTestClass( callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4000,7 +4008,7 @@ abstract class PigeonApiProxyApiSuperClass( api.pigeon_defaultConstructor(), pigeon_identifierArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -4023,7 +4031,7 @@ abstract class PigeonApiProxyApiSuperClass( api.aSuperMethod(pigeon_instanceArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -4064,7 +4072,7 @@ abstract class PigeonApiProxyApiSuperClass( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4102,7 +4110,7 @@ open class PigeonApiProxyApiInterface( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4130,7 +4138,7 @@ open class PigeonApiProxyApiInterface( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } @@ -4170,7 +4178,7 @@ abstract class PigeonApiClassWithApiRequirement( api.pigeon_defaultConstructor(), pigeon_identifierArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -4187,7 +4195,7 @@ abstract class PigeonApiClassWithApiRequirement( if (api != null) { channel.setMessageHandler { _, reply -> reply.reply( - wrapError( + ProxyApiTestsPigeonUtils.wrapError( UnsupportedOperationException( "Call references class `ClassWithApiRequirement`, which requires api version 25."))) } @@ -4211,7 +4219,7 @@ abstract class PigeonApiClassWithApiRequirement( api.aMethod(pigeon_instanceArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + ProxyApiTestsPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -4228,7 +4236,7 @@ abstract class PigeonApiClassWithApiRequirement( if (api != null) { channel.setMessageHandler { _, reply -> reply.reply( - wrapError( + ProxyApiTestsPigeonUtils.wrapError( UnsupportedOperationException( "Call references class `ClassWithApiRequirement`, which requires api version 25."))) } @@ -4270,7 +4278,7 @@ abstract class PigeonApiClassWithApiRequirement( callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(ProxyApiTestsPigeonUtils.createConnectionError(channelName))) } } } diff --git a/packages/pigeon/platform_tests/test_plugin/ios/.gitignore b/packages/pigeon/platform_tests/test_plugin/darwin/.gitignore similarity index 100% rename from packages/pigeon/platform_tests/test_plugin/ios/.gitignore rename to packages/pigeon/platform_tests/test_plugin/darwin/.gitignore diff --git a/packages/pigeon/platform_tests/test_plugin/ios/test_plugin.podspec b/packages/pigeon/platform_tests/test_plugin/darwin/test_plugin.podspec similarity index 77% rename from packages/pigeon/platform_tests/test_plugin/ios/test_plugin.podspec rename to packages/pigeon/platform_tests/test_plugin/darwin/test_plugin.podspec index 9b19ac1850c..42b91b20960 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/test_plugin.podspec +++ b/packages/pigeon/platform_tests/test_plugin/darwin/test_plugin.podspec @@ -13,15 +13,14 @@ Pod::Spec.new do |s| s.license = { :type => 'BSD', :file => '../../../LICENSE' } s.author = { 'Your Company' => 'email@example.com' } s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/pigeon' } - s.source_files = 'Classes/**/*' - s.dependency 'Flutter' - s.platform = :ios, '12.0' - s.xcconfig = { + s.source_files = 'test_plugin/Sources/test_plugin/**/*.swift' + s.ios.dependency 'Flutter' + s.osx.dependency 'FlutterMacOS' + s.ios.deployment_target = '12.0' + s.osx.deployment_target = '10.14' + s.ios.xcconfig = { 'LIBRARY_SEARCH_PATHS' => '$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)/ $(SDKROOT)/usr/lib/swift', 'LD_RUNPATH_SEARCH_PATHS' => '/usr/lib/swift', } - - # Flutter.framework does not contain a i386 slice. - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } s.swift_version = '5.0' end diff --git a/packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Package.swift b/packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Package.swift new file mode 100644 index 00000000000..e13c11f7bfa --- /dev/null +++ b/packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Package.swift @@ -0,0 +1,27 @@ +// swift-tools-version: 5.9 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +// 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. + +import PackageDescription + +let package = Package( + name: "test_plugin", + platforms: [ + .iOS("12.0"), + .macOS("10.14"), + ], + products: [ + .library(name: "test-plugin", targets: ["test_plugin"]) + ], + dependencies: [], + targets: [ + .target( + name: "test_plugin", + dependencies: [], + resources: [] + ) + ] +) diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/.gitignore b/packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/.gitignore similarity index 99% rename from packages/pigeon/platform_tests/test_plugin/ios/Classes/.gitignore rename to packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/.gitignore index 94e339ef912..ad1dc18f98c 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/.gitignore +++ b/packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/.gitignore @@ -5,7 +5,6 @@ !CoreTests.gen.swift # Keeping this makes it easier to review changes to ProxyApi generation. !ProxyApiTests.gen.swift - # Including these makes it easier to review code generation changes. !ProxyApiTestClass.swift !EventChannelTests.gen.swift diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/CoreTests.gen.swift similarity index 100% rename from packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift rename to packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/CoreTests.gen.swift diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/EventChannelTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/EventChannelTests.gen.swift similarity index 100% rename from packages/pigeon/platform_tests/test_plugin/ios/Classes/EventChannelTests.gen.swift rename to packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/EventChannelTests.gen.swift diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/ProxyApiTestClass.swift b/packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/ProxyApiTestClass.swift similarity index 91% rename from packages/pigeon/platform_tests/test_plugin/macos/Classes/ProxyApiTestClass.swift rename to packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/ProxyApiTestClass.swift index f6e7eed44cb..3f5633022d7 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/ProxyApiTestClass.swift +++ b/packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/ProxyApiTestClass.swift @@ -10,5 +10,5 @@ open class ProxyApiSuperClass {} protocol ProxyApiInterface {} -@available(macOS 10, *) +@available(iOS 15, macOS 10, *) class ClassWithApiRequirement {} diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/ProxyApiTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/ProxyApiTests.gen.swift similarity index 100% rename from packages/pigeon/platform_tests/test_plugin/ios/Classes/ProxyApiTests.gen.swift rename to packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/ProxyApiTests.gen.swift diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift b/packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/TestPlugin.swift similarity index 98% rename from packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift rename to packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/TestPlugin.swift index 295a6440875..3783bdbeb85 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift +++ b/packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/TestPlugin.swift @@ -2,8 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import Cocoa -import FlutterMacOS +import Foundation + +#if os(iOS) + import Flutter +#elseif os(macOS) + import FlutterMacOS +#endif /// This plugin handles the native side of the integration tests in /// example/integration_test/. @@ -14,8 +19,14 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { var proxyApiRegistrar: ProxyApiTestsPigeonProxyApiRegistrar? public static func register(with registrar: FlutterPluginRegistrar) { - let plugin = TestPlugin(binaryMessenger: registrar.messenger) - HostIntegrationCoreApiSetup.setUp(binaryMessenger: registrar.messenger, api: plugin) + // Workaround for https://github.com/flutter/flutter/issues/118103. + #if os(iOS) + let messenger = registrar.messenger() + #else + let messenger = registrar.messenger + #endif + let plugin = TestPlugin(binaryMessenger: messenger) + HostIntegrationCoreApiSetup.setUp(binaryMessenger: messenger, api: plugin) TestPluginWithSuffix.register(with: registrar, suffix: "suffixOne") TestPluginWithSuffix.register(with: registrar, suffix: "suffixTwo") registrar.publish(plugin) @@ -27,6 +38,9 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { binaryMessenger: binaryMessenger, messageChannelSuffix: "suffixOne") flutterSmallApiTwo = FlutterSmallApi( binaryMessenger: binaryMessenger, messageChannelSuffix: "suffixTwo") + + StreamIntsStreamHandler.register(with: binaryMessenger, streamHandler: SendInts()) + StreamEventsStreamHandler.register(with: binaryMessenger, streamHandler: SendEvents()) StreamConsistentNumbersStreamHandler.register( with: binaryMessenger, instanceName: "1", streamHandler: SendConsistentNumbers(numberToSend: 1)) @@ -36,9 +50,6 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { proxyApiRegistrar = ProxyApiTestsPigeonProxyApiRegistrar( binaryMessenger: binaryMessenger, apiDelegate: ProxyApiDelegate()) proxyApiRegistrar!.setUp() - - StreamIntsStreamHandler.register(with: binaryMessenger, streamHandler: SendInts()) - StreamEventsStreamHandler.register(with: binaryMessenger, streamHandler: SendEvents()) } public func detachFromEngine(for registrar: FlutterPluginRegistrar) { @@ -1215,9 +1226,15 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { public class TestPluginWithSuffix: HostSmallApi { public static func register(with registrar: FlutterPluginRegistrar, suffix: String) { + // Workaround for https://github.com/flutter/flutter/issues/118103. + #if os(iOS) + let messenger = registrar.messenger() + #else + let messenger = registrar.messenger + #endif let plugin = TestPluginWithSuffix() HostSmallApiSetup.setUp( - binaryMessenger: registrar.messenger, api: plugin, messageChannelSuffix: suffix) + binaryMessenger: messenger, api: plugin, messageChannelSuffix: suffix) } func echo(aString: String, completion: @escaping (Result) -> Void) { @@ -1229,6 +1246,7 @@ public class TestPluginWithSuffix: HostSmallApi { } } + class SendInts: StreamIntsStreamHandler { var timerActive = false var timer: Timer? @@ -2210,14 +2228,14 @@ class ProxyApiDelegate: ProxyApiTestsPigeonProxyApiDelegate { -> PigeonApiClassWithApiRequirement { class ClassWithApiRequirementDelegate: PigeonApiDelegateClassWithApiRequirement { - @available(macOS 10, *) + @available(iOS 15, macOS 10, *) func pigeonDefaultConstructor(pigeonApi: PigeonApiClassWithApiRequirement) throws -> ClassWithApiRequirement { return ClassWithApiRequirement() } - @available(macOS 10, *) + @available(iOS 15, macOS 10, *) func aMethod( pigeonApi: PigeonApiClassWithApiRequirement, pigeonInstance: ClassWithApiRequirement ) throws { diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/Runner.xcodeproj/project.pbxproj b/packages/pigeon/platform_tests/test_plugin/example/ios/Runner.xcodeproj/project.pbxproj index ea266506b36..576c8070408 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/Runner.xcodeproj/project.pbxproj @@ -25,6 +25,7 @@ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 6885ADFFF3D912887C317B7C /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 786308B4AA81D1B6AA2FA10F /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; 8F85C49D2BBB14F30053FB60 /* InstanceManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F85C49C2BBB14F30053FB60 /* InstanceManagerTests.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; @@ -108,6 +109,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, 6885ADFFF3D912887C317B7C /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -239,13 +241,15 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 4D9647CB4932DC9B30ABB8E3 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); dependencies = ( ); name = Runner; + packageProductDependencies = ( + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, + ); productName = Runner; productReference = 97C146EE1CF9000F007C117D /* Runner.app */; productType = "com.apple.product-type.application"; @@ -279,6 +283,9 @@ Base, ); mainGroup = 97C146E51CF9000F007C117D; + packageReferences = ( + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */, + ); productRefGroup = 97C146EF1CF9000F007C117D /* Products */; projectDirPath = ""; projectRoot = ""; @@ -327,23 +334,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 4D9647CB4932DC9B30ABB8E3 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 68071F6E376CAAF900FEFD29 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -772,6 +762,20 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCLocalSwiftPackageReference section */ + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { + isa = XCSwiftPackageProductDependency; + productName = FlutterGeneratedPluginSwiftPackage; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; } diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/pigeon/platform_tests/test_plugin/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 58761a450d7..c30cba8d26f 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -5,6 +5,24 @@ + + + + + + + + + + diff --git a/packages/pigeon/platform_tests/test_plugin/example/macos/Runner.xcodeproj/project.pbxproj b/packages/pigeon/platform_tests/test_plugin/example/macos/Runner.xcodeproj/project.pbxproj index 60de312721d..55a5621471d 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/pigeon/platform_tests/test_plugin/example/macos/Runner.xcodeproj/project.pbxproj @@ -28,6 +28,7 @@ 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; 6315A7A2721DA1118B8E9021 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29E004D53850EB57FB6837A5 /* Pods_RunnerTests.framework */; }; + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; 875D4A972362F737CAF2FE4C /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC0DA6B36ADE41CB6E0674E /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ @@ -103,6 +104,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, 875D4A972362F737CAF2FE4C /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -240,7 +242,6 @@ 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, - 00374FFAF955BD99437C03D6 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -248,6 +249,9 @@ 33CC11202044C79F0003C045 /* PBXTargetDependency */, ); name = Runner; + packageProductDependencies = ( + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, + ); productName = Runner; productReference = 33CC10ED2044A3C60003C045 /* test_plugin_example.app */; productType = "com.apple.product-type.application"; @@ -259,7 +263,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1400; - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 33A341DA291ED36900D34E0F = { @@ -291,6 +295,9 @@ Base, ); mainGroup = 33CC10E42044A3C60003C045; + packageReferences = ( + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */, + ); productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; projectDirPath = ""; projectRoot = ""; @@ -322,23 +329,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 00374FFAF955BD99437C03D6 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -786,6 +776,20 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCLocalSwiftPackageReference section */ + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { + isa = XCSwiftPackageProductDependency; + productName = FlutterGeneratedPluginSwiftPackage; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 33CC10E52044A3C60003C045 /* Project object */; } diff --git a/packages/pigeon/platform_tests/test_plugin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/pigeon/platform_tests/test_plugin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 3e0488488ea..c8eb95c5f73 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/pigeon/platform_tests/test_plugin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,10 +1,28 @@ + + + + + + + + + + diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Assets/.gitkeep b/packages/pigeon/platform_tests/test_plugin/ios/Assets/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/ProxyApiTestClass.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/ProxyApiTestClass.swift deleted file mode 100644 index 04a14c4e69f..00000000000 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/ProxyApiTestClass.swift +++ /dev/null @@ -1,14 +0,0 @@ -// 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. - -import Foundation - -class ProxyApiTestClass: ProxyApiSuperClass, ProxyApiInterface {} - -open class ProxyApiSuperClass {} - -protocol ProxyApiInterface {} - -@available(iOS 15, *) -class ClassWithApiRequirement {} diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift deleted file mode 100644 index 5059fedfeaf..00000000000 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift +++ /dev/null @@ -1,2150 +0,0 @@ -// 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. - -import Flutter -import UIKit - -/// This plugin handles the native side of the integration tests in -/// example/integration_test/. -public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { - - var flutterAPI: FlutterIntegrationCoreApi - var flutterSmallApiOne: FlutterSmallApi - var flutterSmallApiTwo: FlutterSmallApi - var proxyApiRegistrar: ProxyApiTestsPigeonProxyApiRegistrar? - - public static func register(with registrar: FlutterPluginRegistrar) { - let plugin = TestPlugin(binaryMessenger: registrar.messenger()) - HostIntegrationCoreApiSetup.setUp(binaryMessenger: registrar.messenger(), api: plugin) - TestPluginWithSuffix.register(with: registrar, suffix: "suffixOne") - TestPluginWithSuffix.register(with: registrar, suffix: "suffixTwo") - registrar.publish(plugin) - } - - init(binaryMessenger: FlutterBinaryMessenger) { - flutterAPI = FlutterIntegrationCoreApi(binaryMessenger: binaryMessenger) - flutterSmallApiOne = FlutterSmallApi( - binaryMessenger: binaryMessenger, messageChannelSuffix: "suffixOne") - flutterSmallApiTwo = FlutterSmallApi( - binaryMessenger: binaryMessenger, messageChannelSuffix: "suffixTwo") - - StreamIntsStreamHandler.register(with: binaryMessenger, streamHandler: SendInts()) - StreamEventsStreamHandler.register(with: binaryMessenger, streamHandler: SendEvents()) - StreamConsistentNumbersStreamHandler.register( - with: binaryMessenger, instanceName: "1", - streamHandler: SendConsistentNumbers(numberToSend: 1)) - StreamConsistentNumbersStreamHandler.register( - with: binaryMessenger, instanceName: "2", - streamHandler: SendConsistentNumbers(numberToSend: 2)) - proxyApiRegistrar = ProxyApiTestsPigeonProxyApiRegistrar( - binaryMessenger: binaryMessenger, apiDelegate: ProxyApiDelegate()) - proxyApiRegistrar!.setUp() - } - - public func detachFromEngine(for registrar: FlutterPluginRegistrar) { - proxyApiRegistrar!.tearDown() - proxyApiRegistrar = nil - } - - // MARK: HostIntegrationCoreApi implementation - - func noop() { - - } - - func echo(_ everything: AllTypes) -> AllTypes { - return everything - } - - func echo(_ everything: AllNullableTypes?) -> AllNullableTypes? { - return everything - } - func echo(_ everything: AllNullableTypesWithoutRecursion?) throws - -> AllNullableTypesWithoutRecursion? - { - return everything - } - - func throwError() throws -> Any? { - throw PigeonError(code: "code", message: "message", details: "details") - } - - func throwErrorFromVoid() throws { - throw PigeonError(code: "code", message: "message", details: "details") - } - - func throwFlutterError() throws -> Any? { - throw PigeonError(code: "code", message: "message", details: "details") - } - - func echo(_ anInt: Int64) -> Int64 { - return anInt - } - - func echo(_ aDouble: Double) -> Double { - return aDouble - } - - func echo(_ aBool: Bool) -> Bool { - return aBool - } - - func echo(_ aString: String) -> String { - return aString - } - - func echo(_ aUint8List: FlutterStandardTypedData) -> FlutterStandardTypedData { - return aUint8List - } - - func echo(_ anObject: Any) -> Any { - return anObject - } - - func echo(_ list: [Any?]) throws -> [Any?] { - return list - } - - func echo(enumList: [AnEnum?]) throws -> [AnEnum?] { - return enumList - } - - func echo(classList: [AllNullableTypes?]) throws -> [AllNullableTypes?] { - return classList - } - - func echoNonNull(enumList: [AnEnum]) throws -> [AnEnum] { - return enumList - } - - func echoNonNull(classList: [AllNullableTypes]) throws -> [AllNullableTypes] { - return classList - } - - func echo(_ map: [AnyHashable?: Any?]) throws -> [AnyHashable?: Any?] { - return map - } - - func echo(stringMap: [String?: String?]) throws -> [String?: String?] { - return stringMap - } - - func echo(intMap: [Int64?: Int64?]) throws -> [Int64?: Int64?] { - return intMap - } - - func echo(enumMap: [AnEnum?: AnEnum?]) throws -> [AnEnum?: AnEnum?] { - return enumMap - } - - func echo(classMap: [Int64?: AllNullableTypes?]) throws -> [Int64?: AllNullableTypes?] { - return classMap - } - - func echoNonNull(stringMap: [String: String]) throws -> [String: String] { - return stringMap - } - - func echoNonNull(intMap: [Int64: Int64]) throws -> [Int64: Int64] { - return intMap - } - - func echoNonNull(enumMap: [AnEnum: AnEnum]) throws -> [AnEnum: AnEnum] { - return enumMap - } - - func echoNonNull(classMap: [Int64: AllNullableTypes]) throws -> [Int64: AllNullableTypes] { - return classMap - } - - func echo(_ wrapper: AllClassesWrapper) throws -> AllClassesWrapper { - return wrapper - } - - func echo(_ anEnum: AnEnum) throws -> AnEnum { - return anEnum - } - - func echo(_ anotherEnum: AnotherEnum) throws -> AnotherEnum { - return anotherEnum - } - - func extractNestedNullableString(from wrapper: AllClassesWrapper) -> String? { - return wrapper.allNullableTypes.aNullableString - } - - func createNestedObject(with nullableString: String?) -> AllClassesWrapper { - return AllClassesWrapper( - allNullableTypes: AllNullableTypes(aNullableString: nullableString), classList: [], - classMap: [:]) - } - - func sendMultipleNullableTypes( - aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String? - ) -> AllNullableTypes { - let someThings = AllNullableTypes( - aNullableBool: aNullableBool, aNullableInt: aNullableInt, aNullableString: aNullableString) - return someThings - } - - func sendMultipleNullableTypesWithoutRecursion( - aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String? - ) throws -> AllNullableTypesWithoutRecursion { - let someThings = AllNullableTypesWithoutRecursion( - aNullableBool: aNullableBool, aNullableInt: aNullableInt, aNullableString: aNullableString) - return someThings - } - - func echo(_ aNullableInt: Int64?) -> Int64? { - return aNullableInt - } - - func echo(_ aNullableDouble: Double?) -> Double? { - return aNullableDouble - } - - func echo(_ aNullableBool: Bool?) -> Bool? { - return aNullableBool - } - - func echo(_ aNullableString: String?) -> String? { - return aNullableString - } - - func echo(_ aNullableUint8List: FlutterStandardTypedData?) -> FlutterStandardTypedData? { - return aNullableUint8List - } - - func echo(_ aNullableObject: Any?) -> Any? { - return aNullableObject - } - - func echoNamedDefault(_ aString: String) throws -> String { - return aString - } - - func echoOptionalDefault(_ aDouble: Double) throws -> Double { - return aDouble - } - - func echoRequired(_ anInt: Int64) throws -> Int64 { - return anInt - } - - func echoNullable(_ aNullableList: [Any?]?) throws -> [Any?]? { - return aNullableList - } - - func echoNullable(enumList: [AnEnum?]?) throws -> [AnEnum?]? { - return enumList - } - - func echoNullable(classList: [AllNullableTypes?]?) throws -> [AllNullableTypes?]? { - return classList - } - - func echoNullableNonNull(enumList: [AnEnum]?) throws -> [AnEnum]? { - return enumList - } - - func echoNullableNonNull(classList: [AllNullableTypes]?) throws -> [AllNullableTypes]? { - return classList - } - - func echoNullable(_ map: [AnyHashable?: Any?]?) throws -> [AnyHashable?: Any?]? { - return map - } - - func echoNullable(stringMap: [String?: String?]?) throws -> [String?: String?]? { - return stringMap - } - - func echoNullable(intMap: [Int64?: Int64?]?) throws -> [Int64?: Int64?]? { - return intMap - } - - func echoNullable(enumMap: [AnEnum?: AnEnum?]?) throws -> [AnEnum?: AnEnum?]? { - return enumMap - } - - func echoNullable(classMap: [Int64?: AllNullableTypes?]?) throws -> [Int64?: AllNullableTypes?]? { - return classMap - } - - func echoNullableNonNull(stringMap: [String: String]?) throws -> [String: String]? { - return stringMap - } - - func echoNullableNonNull(intMap: [Int64: Int64]?) throws -> [Int64: Int64]? { - return intMap - } - - func echoNullableNonNull(enumMap: [AnEnum: AnEnum]?) throws -> [AnEnum: AnEnum]? { - return enumMap - } - - func echoNullableNonNull(classMap: [Int64: AllNullableTypes]?) throws -> [Int64: - AllNullableTypes]? - { - return classMap - } - - func echoNullable(_ anEnum: AnEnum?) throws -> AnEnum? { - return anEnum - } - - func echoNullable(_ anotherEnum: AnotherEnum?) throws -> AnotherEnum? { - return anotherEnum - } - - func echoOptional(_ aNullableInt: Int64?) throws -> Int64? { - return aNullableInt - } - - func echoNamed(_ aNullableString: String?) throws -> String? { - return aNullableString - } - - func noopAsync(completion: @escaping (Result) -> Void) { - completion(.success(Void())) - } - - func throwAsyncError(completion: @escaping (Result) -> Void) { - completion(.failure(PigeonError(code: "code", message: "message", details: "details"))) - } - - func throwAsyncErrorFromVoid(completion: @escaping (Result) -> Void) { - completion(.failure(PigeonError(code: "code", message: "message", details: "details"))) - } - - func throwAsyncFlutterError(completion: @escaping (Result) -> Void) { - completion(.failure(PigeonError(code: "code", message: "message", details: "details"))) - } - - func echoAsync(_ everything: AllTypes, completion: @escaping (Result) -> Void) { - completion(.success(everything)) - } - - func echoAsync( - _ everything: AllNullableTypes?, - completion: @escaping (Result) -> Void - ) { - completion(.success(everything)) - } - - func echoAsync( - _ everything: AllNullableTypesWithoutRecursion?, - completion: @escaping (Result) -> Void - ) { - completion(.success(everything)) - } - - func echoAsync(_ anInt: Int64, completion: @escaping (Result) -> Void) { - completion(.success(anInt)) - } - - func echoAsync(_ aDouble: Double, completion: @escaping (Result) -> Void) { - completion(.success(aDouble)) - } - - func echoAsync(_ aBool: Bool, completion: @escaping (Result) -> Void) { - completion(.success(aBool)) - } - - func echoAsync(_ aString: String, completion: @escaping (Result) -> Void) { - completion(.success(aString)) - } - - func echoAsync( - _ aUint8List: FlutterStandardTypedData, - completion: @escaping (Result) -> Void - ) { - completion(.success(aUint8List)) - } - - func echoAsync(_ anObject: Any, completion: @escaping (Result) -> Void) { - completion(.success(anObject)) - } - - func echoAsync(_ list: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) { - completion(.success(list)) - } - - func echoAsync(enumList: [AnEnum?], completion: @escaping (Result<[AnEnum?], Error>) -> Void) { - completion(.success(enumList)) - } - - func echoAsync( - classList: [AllNullableTypes?], - completion: @escaping (Result<[AllNullableTypes?], Error>) -> Void - ) { - completion(.success(classList)) - } - - func echoAsync( - _ map: [AnyHashable?: Any?], completion: @escaping (Result<[AnyHashable?: Any?], Error>) -> Void - ) { - completion(.success(map)) - } - - func echoAsync( - stringMap: [String?: String?], completion: @escaping (Result<[String?: String?], Error>) -> Void - ) { - completion(.success(stringMap)) - } - - func echoAsync( - intMap: [Int64?: Int64?], completion: @escaping (Result<[Int64?: Int64?], Error>) -> Void - ) { - completion(.success(intMap)) - } - - func echoAsync( - enumMap: [AnEnum?: AnEnum?], completion: @escaping (Result<[AnEnum?: AnEnum?], Error>) -> Void - ) { - completion(.success(enumMap)) - } - - func echoAsync( - classMap: [Int64?: AllNullableTypes?], - completion: @escaping (Result<[Int64?: AllNullableTypes?], Error>) -> Void - ) { - completion(.success(classMap)) - } - - func echoAsync(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) { - completion(.success(anEnum)) - } - - func echoAsync( - _ anotherEnum: AnotherEnum, completion: @escaping (Result) -> Void - ) { - completion(.success(anotherEnum)) - } - - func echoAsyncNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) { - completion(.success(anInt)) - } - - func echoAsyncNullable(_ aDouble: Double?, completion: @escaping (Result) -> Void) - { - completion(.success(aDouble)) - } - - func echoAsyncNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) { - completion(.success(aBool)) - } - - func echoAsyncNullable(_ aString: String?, completion: @escaping (Result) -> Void) - { - completion(.success(aString)) - } - - func echoAsyncNullable( - _ aUint8List: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void - ) { - completion(.success(aUint8List)) - } - - func echoAsyncNullable(_ anObject: Any?, completion: @escaping (Result) -> Void) { - completion(.success(anObject)) - } - - func echoAsyncNullable(_ list: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) { - completion(.success(list)) - } - - func echoAsyncNullable( - enumList: [AnEnum?]?, completion: @escaping (Result<[AnEnum?]?, Error>) -> Void - ) { - completion(.success(enumList)) - } - - func echoAsyncNullable( - classList: [AllNullableTypes?]?, - completion: @escaping (Result<[AllNullableTypes?]?, Error>) -> Void - ) { - completion(.success(classList)) - } - - func echoAsyncNullable( - _ map: [AnyHashable?: Any?]?, - completion: @escaping (Result<[AnyHashable?: Any?]?, Error>) -> Void - ) { - completion(.success(map)) - } - - func echoAsyncNullable( - stringMap: [String?: String?]?, - completion: @escaping (Result<[String?: String?]?, Error>) -> Void - ) { - completion(.success(stringMap)) - } - - func echoAsyncNullable( - intMap: [Int64?: Int64?]?, completion: @escaping (Result<[Int64?: Int64?]?, Error>) -> Void - ) { - completion(.success(intMap)) - } - - func echoAsyncNullable( - enumMap: [AnEnum?: AnEnum?]?, completion: @escaping (Result<[AnEnum?: AnEnum?]?, Error>) -> Void - ) { - completion(.success(enumMap)) - } - - func echoAsyncNullable( - classMap: [Int64?: AllNullableTypes?]?, - completion: @escaping (Result<[Int64?: AllNullableTypes?]?, Error>) -> Void - ) { - completion(.success(classMap)) - } - - func echoAsyncNullable( - _ anEnum: AnEnum?, completion: @escaping (Result) -> Void - ) { - completion(.success(anEnum)) - } - - func echoAsyncNullable( - _ anotherEnum: AnotherEnum?, completion: @escaping (Result) -> Void - ) { - completion(.success(anotherEnum)) - } - - func defaultIsMainThread() -> Bool { - return Thread.isMainThread - } - - func taskQueueIsBackgroundThread() -> Bool { - return !Thread.isMainThread - } - - func callFlutterNoop(completion: @escaping (Result) -> Void) { - flutterAPI.noop { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterThrowError(completion: @escaping (Result) -> Void) { - flutterAPI.throwError { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterThrowErrorFromVoid(completion: @escaping (Result) -> Void) { - flutterAPI.throwErrorFromVoid { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho( - _ everything: AllTypes, completion: @escaping (Result) -> Void - ) { - flutterAPI.echo(everything) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho( - _ everything: AllNullableTypes?, - completion: @escaping (Result) -> Void - ) { - flutterAPI.echoNullable(everything) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho( - _ everything: AllNullableTypesWithoutRecursion?, - completion: @escaping (Result) -> Void - ) { - flutterAPI.echoNullable(everything) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterSendMultipleNullableTypes( - aBool aNullableBool: Bool?, - anInt aNullableInt: Int64?, - aString aNullableString: String?, - completion: @escaping (Result) -> Void - ) { - flutterAPI.sendMultipleNullableTypes( - aBool: aNullableBool, - anInt: aNullableInt, - aString: aNullableString - ) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterSendMultipleNullableTypesWithoutRecursion( - aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, - completion: @escaping (Result) -> Void - ) { - flutterAPI.sendMultipleNullableTypesWithoutRecursion( - aBool: aNullableBool, - anInt: aNullableInt, - aString: aNullableString - ) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho(_ aBool: Bool, completion: @escaping (Result) -> Void) { - flutterAPI.echo(aBool) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho(_ anInt: Int64, completion: @escaping (Result) -> Void) { - flutterAPI.echo(anInt) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho(_ aDouble: Double, completion: @escaping (Result) -> Void) { - flutterAPI.echo(aDouble) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho(_ aString: String, completion: @escaping (Result) -> Void) { - flutterAPI.echo(aString) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho( - _ list: FlutterStandardTypedData, - completion: @escaping (Result) -> Void - ) { - flutterAPI.echo(list) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho(_ list: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) { - flutterAPI.echo(list) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho( - enumList: [AnEnum?], completion: @escaping (Result<[AnEnum?], Error>) -> Void - ) { - flutterAPI.echo(enumList: enumList) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho( - classList: [AllNullableTypes?], - completion: @escaping (Result<[AllNullableTypes?], Error>) -> Void - ) { - flutterAPI.echo(classList: classList) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNonNull( - enumList: [AnEnum], completion: @escaping (Result<[AnEnum], Error>) -> Void - ) { - flutterAPI.echoNonNull(enumList: enumList) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNonNull( - classList: [AllNullableTypes], completion: @escaping (Result<[AllNullableTypes], Error>) -> Void - ) { - flutterAPI.echoNonNull(classList: classList) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho( - _ map: [AnyHashable?: Any?], completion: @escaping (Result<[AnyHashable?: Any?], Error>) -> Void - ) { - flutterAPI.echo(map) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho( - stringMap: [String?: String?], completion: @escaping (Result<[String?: String?], Error>) -> Void - ) { - flutterAPI.echo(stringMap: stringMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho( - intMap: [Int64?: Int64?], completion: @escaping (Result<[Int64?: Int64?], Error>) -> Void - ) { - flutterAPI.echo(intMap: intMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho( - enumMap: [AnEnum?: AnEnum?], completion: @escaping (Result<[AnEnum?: AnEnum?], Error>) -> Void - ) { - flutterAPI.echo(enumMap: enumMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho( - classMap: [Int64?: AllNullableTypes?], - completion: @escaping (Result<[Int64?: AllNullableTypes?], Error>) -> Void - ) { - flutterAPI.echo(classMap: classMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNonNull( - stringMap: [String: String], completion: @escaping (Result<[String: String], Error>) -> Void - ) { - flutterAPI.echoNonNull(stringMap: stringMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNonNull( - intMap: [Int64: Int64], completion: @escaping (Result<[Int64: Int64], Error>) -> Void - ) { - flutterAPI.echoNonNull(intMap: intMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNonNull( - enumMap: [AnEnum: AnEnum], completion: @escaping (Result<[AnEnum: AnEnum], Error>) -> Void - ) { - flutterAPI.echoNonNull(enumMap: enumMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNonNull( - classMap: [Int64: AllNullableTypes], - completion: @escaping (Result<[Int64: AllNullableTypes], Error>) -> Void - ) { - flutterAPI.echoNonNull(classMap: classMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho( - _ anEnum: AnEnum, completion: @escaping (Result) -> Void - ) { - flutterAPI.echo(anEnum) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEcho( - _ anotherEnum: AnotherEnum, completion: @escaping (Result) -> Void - ) { - flutterAPI.echo(anotherEnum) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) - { - flutterAPI.echoNullable(aBool) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullable( - _ anInt: Int64?, completion: @escaping (Result) -> Void - ) { - flutterAPI.echoNullable(anInt) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullable( - _ aDouble: Double?, completion: @escaping (Result) -> Void - ) { - flutterAPI.echoNullable(aDouble) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullable( - _ aString: String?, completion: @escaping (Result) -> Void - ) { - flutterAPI.echoNullable(aString) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullable( - _ list: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void - ) { - flutterAPI.echoNullable(list) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullable( - _ list: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void - ) { - flutterAPI.echoNullable(list) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullable( - enumList: [AnEnum?]?, completion: @escaping (Result<[AnEnum?]?, Error>) -> Void - ) { - flutterAPI.echoNullable(enumList: enumList) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullable( - classList: [AllNullableTypes?]?, - completion: @escaping (Result<[AllNullableTypes?]?, Error>) -> Void - ) { - flutterAPI.echoNullable(classList: classList) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullableNonNull( - enumList: [AnEnum]?, completion: @escaping (Result<[AnEnum]?, Error>) -> Void - ) { - flutterAPI.echoNullableNonNull(enumList: enumList) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullableNonNull( - classList: [AllNullableTypes]?, - completion: @escaping (Result<[AllNullableTypes]?, Error>) -> Void - ) { - flutterAPI.echoNullableNonNull(classList: classList) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullable( - _ map: [AnyHashable?: Any?]?, - completion: @escaping (Result<[AnyHashable?: Any?]?, Error>) -> Void - ) { - flutterAPI.echoNullable(map) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullable( - stringMap: [String?: String?]?, - completion: @escaping (Result<[String?: String?]?, Error>) -> Void - ) { - flutterAPI.echoNullable(stringMap: stringMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullable( - intMap: [Int64?: Int64?]?, completion: @escaping (Result<[Int64?: Int64?]?, Error>) -> Void - ) { - flutterAPI.echoNullable(intMap: intMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullable( - enumMap: [AnEnum?: AnEnum?]?, completion: @escaping (Result<[AnEnum?: AnEnum?]?, Error>) -> Void - ) { - flutterAPI.echoNullable(enumMap: enumMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullable( - classMap: [Int64?: AllNullableTypes?]?, - completion: @escaping (Result<[Int64?: AllNullableTypes?]?, Error>) -> Void - ) { - flutterAPI.echoNullable(classMap: classMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullableNonNull( - stringMap: [String: String]?, completion: @escaping (Result<[String: String]?, Error>) -> Void - ) { - flutterAPI.echoNullableNonNull(stringMap: stringMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullableNonNull( - intMap: [Int64: Int64]?, completion: @escaping (Result<[Int64: Int64]?, Error>) -> Void - ) { - flutterAPI.echoNullableNonNull(intMap: intMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullableNonNull( - enumMap: [AnEnum: AnEnum]?, completion: @escaping (Result<[AnEnum: AnEnum]?, Error>) -> Void - ) { - flutterAPI.echoNullableNonNull(enumMap: enumMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullableNonNull( - classMap: [Int64: AllNullableTypes]?, - completion: @escaping (Result<[Int64: AllNullableTypes]?, Error>) -> Void - ) { - flutterAPI.echoNullableNonNull(classMap: classMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullable( - _ anEnum: AnEnum?, completion: @escaping (Result) -> Void - ) { - flutterAPI.echoNullable(anEnum) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullable( - _ anotherEnum: AnotherEnum?, completion: @escaping (Result) -> Void - ) { - flutterAPI.echoNullable(anotherEnum) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterSmallApiEcho( - _ aString: String, completion: @escaping (Result) -> Void - ) { - flutterSmallApiOne.echo(string: aString) { responseOne in - self.flutterSmallApiTwo.echo(string: aString) { responseTwo in - switch responseOne { - case .success(let resOne): - switch responseTwo { - case .success(let resTwo): - if resOne == resTwo { - completion(.success(resOne)) - } else { - completion( - .failure( - PigeonError( - code: "", - message: "Multi-instance responses were not matching: \(resOne), \(resTwo)", - details: nil))) - } - case .failure(let error): - completion(.failure(error)) - } - case .failure(let error): - completion(.failure(error)) - } - } - } - } - - func testUnusedClassesGenerate() -> UnusedClass { - return UnusedClass() - } -} - -public class TestPluginWithSuffix: HostSmallApi { - public static func register(with registrar: FlutterPluginRegistrar, suffix: String) { - let plugin = TestPluginWithSuffix() - HostSmallApiSetup.setUp( - binaryMessenger: registrar.messenger(), api: plugin, messageChannelSuffix: suffix) - } - - func echo(aString: String, completion: @escaping (Result) -> Void) { - completion(.success(aString)) - } - - func voidVoid(completion: @escaping (Result) -> Void) { - completion(.success(Void())) - } - -} - -class SendInts: StreamIntsStreamHandler { - var timerActive = false - var timer: Timer? - - override func onListen(withArguments arguments: Any?, sink: PigeonEventSink) { - var count: Int64 = 0 - if !timerActive { - timerActive = true - timer = Timer.scheduledTimer(withTimeInterval: 0.01, repeats: true) { _ in - DispatchQueue.main.async { - sink.success(count) - count += 1 - if count >= 5 { - sink.endOfStream() - self.timer?.invalidate() - } - } - } - } - } -} - -class SendEvents: StreamEventsStreamHandler { - var timerActive = false - var timer: Timer? - var eventList: [PlatformEvent] = - [ - IntEvent(value: 1), - StringEvent(value: "string"), - BoolEvent(value: false), - DoubleEvent(value: 3.14), - ObjectsEvent(value: true), - EnumEvent(value: EventEnum.fortyTwo), - ClassEvent(value: EventAllNullableTypes(aNullableInt: 0)), - ] - - override func onListen(withArguments arguments: Any?, sink: PigeonEventSink) { - var count = 0 - if !timerActive { - timerActive = true - timer = Timer.scheduledTimer(withTimeInterval: 0.01, repeats: true) { _ in - DispatchQueue.main.async { - if count >= self.eventList.count { - sink.endOfStream() - self.timer?.invalidate() - } else { - sink.success(self.eventList[count]) - count += 1 - } - } - } - } - } -} - -class SendConsistentNumbers: StreamConsistentNumbersStreamHandler { - let numberToSend: Int64 - init(numberToSend: Int64) { - self.numberToSend = numberToSend - } - var timerActive = false - var timer: Timer? - - override func onListen(withArguments arguments: Any?, sink: PigeonEventSink) { - let numberThatWillBeSent: Int64 = numberToSend - var count: Int64 = 0 - if !timerActive { - timerActive = true - timer = Timer.scheduledTimer(withTimeInterval: 0.01, repeats: true) { _ in - DispatchQueue.main.async { - sink.success(numberThatWillBeSent) - count += 1 - if count >= 10 { - sink.endOfStream() - self.timer?.invalidate() - } - } - } - } - } -} - -class ProxyApiDelegate: ProxyApiTestsPigeonProxyApiDelegate { - func pigeonApiProxyApiTestClass(_ registrar: ProxyApiTestsPigeonProxyApiRegistrar) - -> PigeonApiProxyApiTestClass - { - class ProxyApiTestClassDelegate: PigeonApiDelegateProxyApiTestClass { - func pigeonDefaultConstructor( - pigeonApi: PigeonApiProxyApiTestClass, aBool: Bool, anInt: Int64, aDouble: Double, - aString: String, aUint8List: FlutterStandardTypedData, aList: [Any?], - aMap: [String?: Any?], - anEnum: ProxyApiTestEnum, aProxyApi: ProxyApiSuperClass, aNullableBool: Bool?, - aNullableInt: Int64?, aNullableDouble: Double?, aNullableString: String?, - aNullableUint8List: FlutterStandardTypedData?, aNullableList: [Any?]?, - aNullableMap: [String?: Any?]?, aNullableEnum: ProxyApiTestEnum?, - aNullableProxyApi: ProxyApiSuperClass?, boolParam: Bool, intParam: Int64, - doubleParam: Double, stringParam: String, aUint8ListParam: FlutterStandardTypedData, - listParam: [Any?], mapParam: [String?: Any?], enumParam: ProxyApiTestEnum, - proxyApiParam: ProxyApiSuperClass, nullableBoolParam: Bool?, nullableIntParam: Int64?, - nullableDoubleParam: Double?, nullableStringParam: String?, - nullableUint8ListParam: FlutterStandardTypedData?, nullableListParam: [Any?]?, - nullableMapParam: [String?: Any?]?, nullableEnumParam: ProxyApiTestEnum?, - nullableProxyApiParam: ProxyApiSuperClass? - ) throws -> ProxyApiTestClass { - return ProxyApiTestClass() - } - - func namedConstructor( - pigeonApi: PigeonApiProxyApiTestClass, aBool: Bool, anInt: Int64, aDouble: Double, - aString: String, aUint8List: FlutterStandardTypedData, aList: [Any?], aMap: [String?: Any?], - anEnum: ProxyApiTestEnum, aProxyApi: ProxyApiSuperClass, aNullableBool: Bool?, - aNullableInt: Int64?, aNullableDouble: Double?, aNullableString: String?, - aNullableUint8List: FlutterStandardTypedData?, aNullableList: [Any?]?, - aNullableMap: [String?: Any?]?, aNullableEnum: ProxyApiTestEnum?, - aNullableProxyApi: ProxyApiSuperClass? - ) throws -> ProxyApiTestClass { - return ProxyApiTestClass() - } - - func attachedField(pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass) - throws -> ProxyApiSuperClass - { - return ProxyApiSuperClass() - } - - func staticAttachedField(pigeonApi: PigeonApiProxyApiTestClass) throws - -> ProxyApiSuperClass - { - return ProxyApiSuperClass() - } - - func noop(pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass) throws { - } - - func throwError(pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass) - throws -> Any? - { - throw ProxyApiTestsError(code: "code", message: "message", details: "details") - } - - func throwErrorFromVoid( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass - ) throws { - throw ProxyApiTestsError(code: "code", message: "message", details: "details") - } - - func throwFlutterError( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass - ) throws -> Any? { - throw ProxyApiTestsError(code: "code", message: "message", details: "details") - } - - func echoInt( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, anInt: Int64 - ) throws -> Int64 { - return anInt - } - - func echoDouble( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aDouble: Double - ) throws -> Double { - return aDouble - } - - func echoBool( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aBool: Bool - ) throws -> Bool { - return aBool - } - - func echoString( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aString: String - ) throws -> String { - return aString - } - - func echoUint8List( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aUint8List: FlutterStandardTypedData - ) throws -> FlutterStandardTypedData { - return aUint8List - } - - func echoObject( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, anObject: Any - ) throws -> Any { - return anObject - } - - func echoList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aList: [Any?] - ) throws -> [Any?] { - return aList - } - - func echoProxyApiList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aList: [ProxyApiTestClass] - ) throws -> [ProxyApiTestClass] { - return aList - } - - func echoMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aMap: [String?: Any?] - ) throws -> [String?: Any?] { - return aMap - } - - func echoProxyApiMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aMap: [String: ProxyApiTestClass] - ) throws -> [String: ProxyApiTestClass] { - return aMap - } - - func echoEnum( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - anEnum: ProxyApiTestEnum - ) throws -> ProxyApiTestEnum { - return anEnum - } - - func echoProxyApi( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aProxyApi: ProxyApiSuperClass - ) throws -> ProxyApiSuperClass { - return aProxyApi - } - - func echoNullableInt( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableInt: Int64? - ) throws -> Int64? { - return aNullableInt - } - - func echoNullableDouble( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableDouble: Double? - ) throws -> Double? { - return aNullableDouble - } - - func echoNullableBool( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableBool: Bool? - ) throws -> Bool? { - return aNullableBool - } - - func echoNullableString( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableString: String? - ) throws -> String? { - return aNullableString - } - - func echoNullableUint8List( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableUint8List: FlutterStandardTypedData? - ) throws -> FlutterStandardTypedData? { - return aNullableUint8List - } - - func echoNullableObject( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableObject: Any? - ) throws -> Any? { - return aNullableObject - } - - func echoNullableList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableList: [Any?]? - ) throws -> [Any?]? { - return aNullableList - } - - func echoNullableMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableMap: [String?: Any?]? - ) throws -> [String?: Any?]? { - return aNullableMap - } - - func echoNullableEnum( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableEnum: ProxyApiTestEnum? - ) throws -> ProxyApiTestEnum? { - return aNullableEnum - } - - func echoNullableProxyApi( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableProxyApi: ProxyApiSuperClass? - ) throws -> ProxyApiSuperClass? { - return aNullableProxyApi - } - - func noopAsync( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void - ) { - completion(.success(Void())) - } - - func echoAsyncInt( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, anInt: Int64, - completion: @escaping (Result) -> Void - ) { - completion(.success(anInt)) - } - - func echoAsyncDouble( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aDouble: Double, - completion: @escaping (Result) -> Void - ) { - completion(.success(aDouble)) - } - - func echoAsyncBool( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aBool: Bool, - completion: @escaping (Result) -> Void - ) { - completion(.success(aBool)) - } - - func echoAsyncString( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aString: String, - completion: @escaping (Result) -> Void - ) { - completion(.success(aString)) - } - - func echoAsyncUint8List( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aUint8List: FlutterStandardTypedData, - completion: @escaping (Result) -> Void - ) { - completion(.success(aUint8List)) - } - - func echoAsyncObject( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, anObject: Any, - completion: @escaping (Result) -> Void - ) { - completion(.success(anObject)) - } - - func echoAsyncList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aList: [Any?], - completion: @escaping (Result<[Any?], Error>) -> Void - ) { - completion(.success(aList)) - } - - func echoAsyncMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void - ) { - completion(.success(aMap)) - } - - func echoAsyncEnum( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - anEnum: ProxyApiTestEnum, - completion: @escaping (Result) -> Void - ) { - completion(.success(anEnum)) - } - - func throwAsyncError( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void - ) { - completion( - .failure(ProxyApiTestsError(code: "code", message: "message", details: "details"))) - } - - func throwAsyncErrorFromVoid( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void - ) { - completion( - .failure(ProxyApiTestsError(code: "code", message: "message", details: "details"))) - } - - func throwAsyncFlutterError( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void - ) { - completion( - .failure(ProxyApiTestsError(code: "code", message: "message", details: "details"))) - } - - func echoAsyncNullableInt( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, anInt: Int64?, - completion: @escaping (Result) -> Void - ) { - completion(.success(anInt)) - } - - func echoAsyncNullableDouble( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aDouble: Double?, - completion: @escaping (Result) -> Void - ) { - completion(.success(aDouble)) - } - - func echoAsyncNullableBool( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aBool: Bool?, - completion: @escaping (Result) -> Void - ) { - completion(.success(aBool)) - } - - func echoAsyncNullableString( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aString: String?, - completion: @escaping (Result) -> Void - ) { - completion(.success(aString)) - } - - func echoAsyncNullableUint8List( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aUint8List: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void - ) { - completion(.success(aUint8List)) - } - - func echoAsyncNullableObject( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - anObject: Any?, - completion: @escaping (Result) -> Void - ) { - completion(.success(anObject)) - } - - func echoAsyncNullableList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aList: [Any?]?, - completion: @escaping (Result<[Any?]?, Error>) -> Void - ) { - completion(.success(aList)) - } - - func echoAsyncNullableMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void - ) { - completion(.success(aMap)) - } - - func echoAsyncNullableEnum( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - anEnum: ProxyApiTestEnum?, - completion: @escaping (Result) -> Void - ) { - completion(.success(anEnum)) - } - - func staticNoop(pigeonApi: PigeonApiProxyApiTestClass) throws { - - } - - func echoStaticString(pigeonApi: PigeonApiProxyApiTestClass, aString: String) throws - -> String - { - return aString - } - - func staticAsyncNoop( - pigeonApi: PigeonApiProxyApiTestClass, - completion: @escaping (Result) -> Void - ) { - completion(.success(Void())) - } - - func callFlutterNoop( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterNoop(pigeonInstance: pigeonInstance) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterThrowError( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterThrowError(pigeonInstance: pigeonInstance) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterThrowErrorFromVoid( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterThrowErrorFromVoid(pigeonInstance: pigeonInstance) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoBool( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aBool: Bool, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterEchoBool(pigeonInstance: pigeonInstance, aBool: aBool) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoInt( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, anInt: Int64, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterEchoInt(pigeonInstance: pigeonInstance, anInt: anInt) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoDouble( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aDouble: Double, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterEchoDouble(pigeonInstance: pigeonInstance, aDouble: aDouble) { - response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoString( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aString: String, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterEchoString(pigeonInstance: pigeonInstance, aString: aString) { - response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoUint8List( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aUint8List: FlutterStandardTypedData, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterEchoUint8List(pigeonInstance: pigeonInstance, aList: aUint8List) { - response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aList: [Any?], - completion: @escaping (Result<[Any?], Error>) -> Void - ) { - pigeonApi.flutterEchoList(pigeonInstance: pigeonInstance, aList: aList) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoProxyApiList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aList: [ProxyApiTestClass?], - completion: @escaping (Result<[ProxyApiTestClass?], Error>) -> Void - ) { - pigeonApi.flutterEchoProxyApiList(pigeonInstance: pigeonInstance, aList: aList) { - response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void - ) { - pigeonApi.flutterEchoMap(pigeonInstance: pigeonInstance, aMap: aMap) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoProxyApiMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aMap: [String?: ProxyApiTestClass?], - completion: @escaping (Result<[String?: ProxyApiTestClass?], Error>) -> Void - ) { - pigeonApi.flutterEchoProxyApiMap(pigeonInstance: pigeonInstance, aMap: aMap) { - response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoEnum( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - anEnum: ProxyApiTestEnum, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterEchoEnum(pigeonInstance: pigeonInstance, anEnum: anEnum) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoProxyApi( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aProxyApi: ProxyApiSuperClass, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterEchoProxyApi(pigeonInstance: pigeonInstance, aProxyApi: aProxyApi) { - response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullableBool( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aBool: Bool?, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterEchoNullableBool(pigeonInstance: pigeonInstance, aBool: aBool) { - response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullableInt( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, anInt: Int64?, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterEchoNullableInt(pigeonInstance: pigeonInstance, anInt: anInt) { - response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullableDouble( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aDouble: Double?, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterEchoNullableDouble(pigeonInstance: pigeonInstance, aDouble: aDouble) { - response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullableString( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aString: String?, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterEchoNullableString(pigeonInstance: pigeonInstance, aString: aString) { - response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullableUint8List( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aUint8List: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterEchoNullableUint8List( - pigeonInstance: pigeonInstance, aList: aUint8List - ) { - response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullableList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aList: [Any?]?, - completion: @escaping (Result<[Any?]?, Error>) -> Void - ) { - pigeonApi.flutterEchoNullableList(pigeonInstance: pigeonInstance, aList: aList) { - response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullableMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void - ) { - pigeonApi.flutterEchoNullableMap(pigeonInstance: pigeonInstance, aMap: aMap) { - response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullableEnum( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - anEnum: ProxyApiTestEnum?, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterEchoNullableEnum(pigeonInstance: pigeonInstance, anEnum: anEnum) { - response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoNullableProxyApi( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aProxyApi: ProxyApiSuperClass?, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterEchoNullableProxyApi( - pigeonInstance: pigeonInstance, aProxyApi: aProxyApi - ) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterNoopAsync( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterNoopAsync(pigeonInstance: pigeonInstance) { response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - func callFlutterEchoAsyncString( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aString: String, - completion: @escaping (Result) -> Void - ) { - pigeonApi.flutterEchoAsyncString(pigeonInstance: pigeonInstance, aString: aString) { - response in - switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } - } - } - - } - return PigeonApiProxyApiTestClass( - pigeonRegistrar: registrar, delegate: ProxyApiTestClassDelegate()) - } - - func pigeonApiProxyApiSuperClass(_ registrar: ProxyApiTestsPigeonProxyApiRegistrar) - -> PigeonApiProxyApiSuperClass - { - class ProxyApiSuperClassDelegate: PigeonApiDelegateProxyApiSuperClass { - func pigeonDefaultConstructor(pigeonApi: PigeonApiProxyApiSuperClass) throws - -> ProxyApiSuperClass - { - return ProxyApiSuperClass() - } - - func aSuperMethod( - pigeonApi: PigeonApiProxyApiSuperClass, pigeonInstance: ProxyApiSuperClass - ) - throws - {} - } - return PigeonApiProxyApiSuperClass( - pigeonRegistrar: registrar, delegate: ProxyApiSuperClassDelegate()) - } - - func pigeonApiClassWithApiRequirement(_ registrar: ProxyApiTestsPigeonProxyApiRegistrar) - -> PigeonApiClassWithApiRequirement - { - class ClassWithApiRequirementDelegate: PigeonApiDelegateClassWithApiRequirement { - @available(iOS 15, *) - func pigeonDefaultConstructor(pigeonApi: PigeonApiClassWithApiRequirement) throws - -> ClassWithApiRequirement - { - return ClassWithApiRequirement() - } - - @available(iOS 15, *) - func aMethod( - pigeonApi: PigeonApiClassWithApiRequirement, pigeonInstance: ClassWithApiRequirement - ) throws { - - } - } - - return PigeonApiClassWithApiRequirement( - pigeonRegistrar: registrar, delegate: ClassWithApiRequirementDelegate()) - } -} diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/.gitignore b/packages/pigeon/platform_tests/test_plugin/macos/Classes/.gitignore deleted file mode 100644 index cd69c2f5c29..00000000000 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -# TODO(stuartmorgan): Remove this, so that review will show the effects of -# changes on generated files. This will need a way to avoid unnecessary churn, -# such as a flag to suppress version stamp generation. -*.gen.swift -!CoreTests.gen.swift -# Keeping this makes it easier to review changes to ProxyApi generation. -!ProxyApiTests.gen.swift -# Including these makes it easier to review code generation changes. -!ProxyApiTestClass.swift -!EventChannelTests.gen.swift \ No newline at end of file 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 deleted file mode 100644 index 8b1bb6c3627..00000000000 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift +++ /dev/null @@ -1,6011 +0,0 @@ -// 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 -#elseif os(macOS) - import FlutterMacOS -#else - #error("Unsupported platform.") -#endif - -/// Error class for passing custom error details to Dart side. -final class PigeonError: Error { - let code: String - let message: String? - let details: Sendable? - - init(code: String, message: String?, details: Sendable?) { - self.code = code - self.message = message - self.details = details - } - - var localizedDescription: String { - return - "PigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" - } -} - -private func wrapResult(_ result: Any?) -> [Any?] { - return [result] -} - -private func wrapError(_ error: Any) -> [Any?] { - if let pigeonError = error as? PigeonError { - return [ - pigeonError.code, - pigeonError.message, - pigeonError.details, - ] - } - if let flutterError = error as? FlutterError { - return [ - flutterError.code, - flutterError.message, - flutterError.details, - ] - } - return [ - "\(error)", - "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)", - ] -} - -private func createConnectionError(withChannelName channelName: String) -> PigeonError { - return PigeonError( - code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", - details: "") -} - -private func isNullish(_ value: Any?) -> Bool { - return value is NSNull || value == nil -} - -private func nilOrValue(_ value: Any?) -> T? { - if value is NSNull { return nil } - return value as! T? -} - -func deepEqualsCoreTests(_ lhs: Any?, _ rhs: Any?) -> Bool { - let cleanLhs = nilOrValue(lhs) as Any? - let cleanRhs = nilOrValue(rhs) as Any? - switch (cleanLhs, cleanRhs) { - case (nil, nil): - return true - - case (nil, _), (_, nil): - return false - - case is (Void, Void): - return true - - case let (cleanLhsHashable, cleanRhsHashable) as (AnyHashable, AnyHashable): - return cleanLhsHashable == cleanRhsHashable - - case let (cleanLhsArray, cleanRhsArray) as ([Any?], [Any?]): - guard cleanLhsArray.count == cleanRhsArray.count else { return false } - for (index, element) in cleanLhsArray.enumerated() { - if !deepEqualsCoreTests(element, cleanRhsArray[index]) { - return false - } - } - return true - - case let (cleanLhsDictionary, cleanRhsDictionary) as ([AnyHashable: Any?], [AnyHashable: Any?]): - guard cleanLhsDictionary.count == cleanRhsDictionary.count else { return false } - for (key, cleanLhsValue) in cleanLhsDictionary { - guard cleanRhsDictionary.index(forKey: key) != nil else { return false } - if !deepEqualsCoreTests(cleanLhsValue, cleanRhsDictionary[key]!) { - return false - } - } - return true - - default: - // Any other type shouldn't be able to be used with pigeon. File an issue if you find this to be untrue. - return false - } -} - -func deepHashCoreTests(value: Any?, hasher: inout Hasher) { - if let valueList = value as? [AnyHashable] { - for item in valueList { deepHashCoreTests(value: item, hasher: &hasher) } - return - } - - if let valueDict = value as? [AnyHashable: AnyHashable] { - for key in valueDict.keys { - hasher.combine(key) - deepHashCoreTests(value: valueDict[key]!, hasher: &hasher) - } - return - } - - if let hashableValue = value as? AnyHashable { - hasher.combine(hashableValue.hashValue) - } - - return hasher.combine(String(describing: value)) -} - -enum AnEnum: Int { - case one = 0 - case two = 1 - case three = 2 - case fortyTwo = 3 - case fourHundredTwentyTwo = 4 -} - -enum AnotherEnum: Int { - case justInCase = 0 -} - -/// Generated class from Pigeon that represents data sent in messages. -struct UnusedClass: Hashable { - var aField: Any? = nil - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> UnusedClass? { - let aField: Any? = pigeonVar_list[0] - - return UnusedClass( - aField: aField - ) - } - func toList() -> [Any?] { - return [ - aField - ] - } - static func == (lhs: UnusedClass, rhs: UnusedClass) -> Bool { - return deepEqualsCoreTests(lhs.toList(), rhs.toList()) - } - func hash(into hasher: inout Hasher) { - deepHashCoreTests(value: toList(), hasher: &hasher) - } -} - -/// A class containing all supported types. -/// -/// Generated class from Pigeon that represents data sent in messages. -struct AllTypes: Hashable { - var aBool: Bool - var anInt: Int64 - var anInt64: Int64 - var aDouble: Double - var aByteArray: FlutterStandardTypedData - var a4ByteArray: FlutterStandardTypedData - var a8ByteArray: FlutterStandardTypedData - var aFloatArray: FlutterStandardTypedData - var anEnum: AnEnum - var anotherEnum: AnotherEnum - var aString: String - var anObject: Any - var list: [Any?] - var stringList: [String] - var intList: [Int64] - var doubleList: [Double] - var boolList: [Bool] - var enumList: [AnEnum] - var objectList: [Any] - var listList: [[Any?]] - var mapList: [[AnyHashable?: Any?]] - var map: [AnyHashable?: Any?] - var stringMap: [String: String] - var intMap: [Int64: Int64] - var enumMap: [AnEnum: AnEnum] - var objectMap: [AnyHashable: Any] - var listMap: [Int64: [Any?]] - var mapMap: [Int64: [AnyHashable?: Any?]] - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> AllTypes? { - let aBool = pigeonVar_list[0] as! Bool - let anInt = pigeonVar_list[1] as! Int64 - let anInt64 = pigeonVar_list[2] as! Int64 - let aDouble = pigeonVar_list[3] as! Double - let aByteArray = pigeonVar_list[4] as! FlutterStandardTypedData - let a4ByteArray = pigeonVar_list[5] as! FlutterStandardTypedData - let a8ByteArray = pigeonVar_list[6] as! FlutterStandardTypedData - let aFloatArray = pigeonVar_list[7] as! FlutterStandardTypedData - let anEnum = pigeonVar_list[8] as! AnEnum - let anotherEnum = pigeonVar_list[9] as! AnotherEnum - let aString = pigeonVar_list[10] as! String - let anObject = pigeonVar_list[11]! - let list = pigeonVar_list[12] as! [Any?] - let stringList = pigeonVar_list[13] as! [String] - let intList = pigeonVar_list[14] as! [Int64] - let doubleList = pigeonVar_list[15] as! [Double] - let boolList = pigeonVar_list[16] as! [Bool] - let enumList = pigeonVar_list[17] as! [AnEnum] - let objectList = pigeonVar_list[18] as! [Any] - let listList = pigeonVar_list[19] as! [[Any?]] - let mapList = pigeonVar_list[20] as! [[AnyHashable?: Any?]] - let map = pigeonVar_list[21] as! [AnyHashable?: Any?] - let stringMap = pigeonVar_list[22] as! [String: String] - let intMap = pigeonVar_list[23] as! [Int64: Int64] - let enumMap = pigeonVar_list[24] as? [AnEnum: AnEnum] - let objectMap = pigeonVar_list[25] as! [AnyHashable: Any] - let listMap = pigeonVar_list[26] as! [Int64: [Any?]] - let mapMap = pigeonVar_list[27] as! [Int64: [AnyHashable?: Any?]] - - return AllTypes( - aBool: aBool, - anInt: anInt, - anInt64: anInt64, - aDouble: aDouble, - aByteArray: aByteArray, - a4ByteArray: a4ByteArray, - a8ByteArray: a8ByteArray, - aFloatArray: aFloatArray, - anEnum: anEnum, - anotherEnum: anotherEnum, - aString: aString, - anObject: anObject, - list: list, - stringList: stringList, - intList: intList, - doubleList: doubleList, - boolList: boolList, - enumList: enumList, - objectList: objectList, - listList: listList, - mapList: mapList, - map: map, - stringMap: stringMap, - intMap: intMap, - enumMap: enumMap!, - objectMap: objectMap, - listMap: listMap, - mapMap: mapMap - ) - } - func toList() -> [Any?] { - return [ - aBool, - anInt, - anInt64, - aDouble, - aByteArray, - a4ByteArray, - a8ByteArray, - aFloatArray, - anEnum, - anotherEnum, - aString, - anObject, - list, - stringList, - intList, - doubleList, - boolList, - enumList, - objectList, - listList, - mapList, - map, - stringMap, - intMap, - enumMap, - objectMap, - listMap, - mapMap, - ] - } - static func == (lhs: AllTypes, rhs: AllTypes) -> Bool { - return deepEqualsCoreTests(lhs.toList(), rhs.toList()) - } - func hash(into hasher: inout Hasher) { - deepHashCoreTests(value: toList(), hasher: &hasher) - } -} - -/// A class containing all supported nullable types. -/// -/// Generated class from Pigeon that represents data sent in messages. -class AllNullableTypes: Hashable { - init( - aNullableBool: Bool? = nil, - aNullableInt: Int64? = nil, - aNullableInt64: Int64? = nil, - aNullableDouble: Double? = nil, - aNullableByteArray: FlutterStandardTypedData? = nil, - aNullable4ByteArray: FlutterStandardTypedData? = nil, - aNullable8ByteArray: FlutterStandardTypedData? = nil, - aNullableFloatArray: FlutterStandardTypedData? = nil, - aNullableEnum: AnEnum? = nil, - anotherNullableEnum: AnotherEnum? = nil, - aNullableString: String? = nil, - aNullableObject: Any? = nil, - allNullableTypes: AllNullableTypes? = nil, - list: [Any?]? = nil, - stringList: [String?]? = nil, - intList: [Int64?]? = nil, - doubleList: [Double?]? = nil, - boolList: [Bool?]? = nil, - enumList: [AnEnum?]? = nil, - objectList: [Any?]? = nil, - listList: [[Any?]?]? = nil, - mapList: [[AnyHashable?: Any?]?]? = nil, - recursiveClassList: [AllNullableTypes?]? = nil, - map: [AnyHashable?: Any?]? = nil, - stringMap: [String?: String?]? = nil, - intMap: [Int64?: Int64?]? = nil, - enumMap: [AnEnum?: AnEnum?]? = nil, - objectMap: [AnyHashable?: Any?]? = nil, - listMap: [Int64?: [Any?]?]? = nil, - mapMap: [Int64?: [AnyHashable?: Any?]?]? = nil, - recursiveClassMap: [Int64?: AllNullableTypes?]? = nil - ) { - self.aNullableBool = aNullableBool - self.aNullableInt = aNullableInt - self.aNullableInt64 = aNullableInt64 - self.aNullableDouble = aNullableDouble - self.aNullableByteArray = aNullableByteArray - self.aNullable4ByteArray = aNullable4ByteArray - self.aNullable8ByteArray = aNullable8ByteArray - self.aNullableFloatArray = aNullableFloatArray - self.aNullableEnum = aNullableEnum - self.anotherNullableEnum = anotherNullableEnum - self.aNullableString = aNullableString - self.aNullableObject = aNullableObject - self.allNullableTypes = allNullableTypes - self.list = list - self.stringList = stringList - self.intList = intList - self.doubleList = doubleList - self.boolList = boolList - self.enumList = enumList - self.objectList = objectList - self.listList = listList - self.mapList = mapList - self.recursiveClassList = recursiveClassList - self.map = map - self.stringMap = stringMap - self.intMap = intMap - self.enumMap = enumMap - self.objectMap = objectMap - self.listMap = listMap - self.mapMap = mapMap - self.recursiveClassMap = recursiveClassMap - } - var aNullableBool: Bool? - var aNullableInt: Int64? - var aNullableInt64: Int64? - var aNullableDouble: Double? - var aNullableByteArray: FlutterStandardTypedData? - var aNullable4ByteArray: FlutterStandardTypedData? - var aNullable8ByteArray: FlutterStandardTypedData? - var aNullableFloatArray: FlutterStandardTypedData? - var aNullableEnum: AnEnum? - var anotherNullableEnum: AnotherEnum? - var aNullableString: String? - var aNullableObject: Any? - var allNullableTypes: AllNullableTypes? - var list: [Any?]? - var stringList: [String?]? - var intList: [Int64?]? - var doubleList: [Double?]? - var boolList: [Bool?]? - var enumList: [AnEnum?]? - var objectList: [Any?]? - var listList: [[Any?]?]? - var mapList: [[AnyHashable?: Any?]?]? - var recursiveClassList: [AllNullableTypes?]? - var map: [AnyHashable?: Any?]? - var stringMap: [String?: String?]? - var intMap: [Int64?: Int64?]? - var enumMap: [AnEnum?: AnEnum?]? - var objectMap: [AnyHashable?: Any?]? - var listMap: [Int64?: [Any?]?]? - var mapMap: [Int64?: [AnyHashable?: Any?]?]? - var recursiveClassMap: [Int64?: AllNullableTypes?]? - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> AllNullableTypes? { - let aNullableBool: Bool? = nilOrValue(pigeonVar_list[0]) - let aNullableInt: Int64? = nilOrValue(pigeonVar_list[1]) - let aNullableInt64: Int64? = nilOrValue(pigeonVar_list[2]) - let aNullableDouble: Double? = nilOrValue(pigeonVar_list[3]) - let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[4]) - let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[5]) - let aNullable8ByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[6]) - let aNullableFloatArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[7]) - let aNullableEnum: AnEnum? = nilOrValue(pigeonVar_list[8]) - let anotherNullableEnum: AnotherEnum? = nilOrValue(pigeonVar_list[9]) - let aNullableString: String? = nilOrValue(pigeonVar_list[10]) - let aNullableObject: Any? = pigeonVar_list[11] - let allNullableTypes: AllNullableTypes? = nilOrValue(pigeonVar_list[12]) - let list: [Any?]? = nilOrValue(pigeonVar_list[13]) - let stringList: [String?]? = nilOrValue(pigeonVar_list[14]) - let intList: [Int64?]? = nilOrValue(pigeonVar_list[15]) - let doubleList: [Double?]? = nilOrValue(pigeonVar_list[16]) - let boolList: [Bool?]? = nilOrValue(pigeonVar_list[17]) - let enumList: [AnEnum?]? = nilOrValue(pigeonVar_list[18]) - let objectList: [Any?]? = nilOrValue(pigeonVar_list[19]) - let listList: [[Any?]?]? = nilOrValue(pigeonVar_list[20]) - let mapList: [[AnyHashable?: Any?]?]? = nilOrValue(pigeonVar_list[21]) - let recursiveClassList: [AllNullableTypes?]? = nilOrValue(pigeonVar_list[22]) - let map: [AnyHashable?: Any?]? = nilOrValue(pigeonVar_list[23]) - let stringMap: [String?: String?]? = nilOrValue(pigeonVar_list[24]) - let intMap: [Int64?: Int64?]? = nilOrValue(pigeonVar_list[25]) - let enumMap: [AnEnum?: AnEnum?]? = pigeonVar_list[26] as? [AnEnum?: AnEnum?] - let objectMap: [AnyHashable?: Any?]? = nilOrValue(pigeonVar_list[27]) - let listMap: [Int64?: [Any?]?]? = nilOrValue(pigeonVar_list[28]) - let mapMap: [Int64?: [AnyHashable?: Any?]?]? = nilOrValue(pigeonVar_list[29]) - let recursiveClassMap: [Int64?: AllNullableTypes?]? = nilOrValue(pigeonVar_list[30]) - - return AllNullableTypes( - aNullableBool: aNullableBool, - aNullableInt: aNullableInt, - aNullableInt64: aNullableInt64, - aNullableDouble: aNullableDouble, - aNullableByteArray: aNullableByteArray, - aNullable4ByteArray: aNullable4ByteArray, - aNullable8ByteArray: aNullable8ByteArray, - aNullableFloatArray: aNullableFloatArray, - aNullableEnum: aNullableEnum, - anotherNullableEnum: anotherNullableEnum, - aNullableString: aNullableString, - aNullableObject: aNullableObject, - allNullableTypes: allNullableTypes, - list: list, - stringList: stringList, - intList: intList, - doubleList: doubleList, - boolList: boolList, - enumList: enumList, - objectList: objectList, - listList: listList, - mapList: mapList, - recursiveClassList: recursiveClassList, - map: map, - stringMap: stringMap, - intMap: intMap, - enumMap: enumMap, - objectMap: objectMap, - listMap: listMap, - mapMap: mapMap, - recursiveClassMap: recursiveClassMap - ) - } - func toList() -> [Any?] { - return [ - aNullableBool, - aNullableInt, - aNullableInt64, - aNullableDouble, - aNullableByteArray, - aNullable4ByteArray, - aNullable8ByteArray, - aNullableFloatArray, - aNullableEnum, - anotherNullableEnum, - aNullableString, - aNullableObject, - allNullableTypes, - list, - stringList, - intList, - doubleList, - boolList, - enumList, - objectList, - listList, - mapList, - recursiveClassList, - map, - stringMap, - intMap, - enumMap, - objectMap, - listMap, - mapMap, - recursiveClassMap, - ] - } - static func == (lhs: AllNullableTypes, rhs: AllNullableTypes) -> Bool { - if lhs === rhs { - return true - } - return deepEqualsCoreTests(lhs.toList(), rhs.toList()) - } - func hash(into hasher: inout Hasher) { - deepHashCoreTests(value: toList(), hasher: &hasher) - } -} - -/// The primary purpose for this class is to ensure coverage of Swift structs -/// with nullable items, as the primary [AllNullableTypes] class is being used to -/// test Swift classes. -/// -/// Generated class from Pigeon that represents data sent in messages. -struct AllNullableTypesWithoutRecursion: Hashable { - var aNullableBool: Bool? = nil - var aNullableInt: Int64? = nil - var aNullableInt64: Int64? = nil - var aNullableDouble: Double? = nil - var aNullableByteArray: FlutterStandardTypedData? = nil - var aNullable4ByteArray: FlutterStandardTypedData? = nil - var aNullable8ByteArray: FlutterStandardTypedData? = nil - var aNullableFloatArray: FlutterStandardTypedData? = nil - var aNullableEnum: AnEnum? = nil - var anotherNullableEnum: AnotherEnum? = nil - var aNullableString: String? = nil - var aNullableObject: Any? = nil - var list: [Any?]? = nil - var stringList: [String?]? = nil - var intList: [Int64?]? = nil - var doubleList: [Double?]? = nil - var boolList: [Bool?]? = nil - var enumList: [AnEnum?]? = nil - var objectList: [Any?]? = nil - var listList: [[Any?]?]? = nil - var mapList: [[AnyHashable?: Any?]?]? = nil - var map: [AnyHashable?: Any?]? = nil - var stringMap: [String?: String?]? = nil - var intMap: [Int64?: Int64?]? = nil - var enumMap: [AnEnum?: AnEnum?]? = nil - var objectMap: [AnyHashable?: Any?]? = nil - var listMap: [Int64?: [Any?]?]? = nil - var mapMap: [Int64?: [AnyHashable?: Any?]?]? = nil - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> AllNullableTypesWithoutRecursion? { - let aNullableBool: Bool? = nilOrValue(pigeonVar_list[0]) - let aNullableInt: Int64? = nilOrValue(pigeonVar_list[1]) - let aNullableInt64: Int64? = nilOrValue(pigeonVar_list[2]) - let aNullableDouble: Double? = nilOrValue(pigeonVar_list[3]) - let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[4]) - let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[5]) - let aNullable8ByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[6]) - let aNullableFloatArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[7]) - let aNullableEnum: AnEnum? = nilOrValue(pigeonVar_list[8]) - let anotherNullableEnum: AnotherEnum? = nilOrValue(pigeonVar_list[9]) - let aNullableString: String? = nilOrValue(pigeonVar_list[10]) - let aNullableObject: Any? = pigeonVar_list[11] - let list: [Any?]? = nilOrValue(pigeonVar_list[12]) - let stringList: [String?]? = nilOrValue(pigeonVar_list[13]) - let intList: [Int64?]? = nilOrValue(pigeonVar_list[14]) - let doubleList: [Double?]? = nilOrValue(pigeonVar_list[15]) - let boolList: [Bool?]? = nilOrValue(pigeonVar_list[16]) - let enumList: [AnEnum?]? = nilOrValue(pigeonVar_list[17]) - let objectList: [Any?]? = nilOrValue(pigeonVar_list[18]) - let listList: [[Any?]?]? = nilOrValue(pigeonVar_list[19]) - let mapList: [[AnyHashable?: Any?]?]? = nilOrValue(pigeonVar_list[20]) - let map: [AnyHashable?: Any?]? = nilOrValue(pigeonVar_list[21]) - let stringMap: [String?: String?]? = nilOrValue(pigeonVar_list[22]) - let intMap: [Int64?: Int64?]? = nilOrValue(pigeonVar_list[23]) - let enumMap: [AnEnum?: AnEnum?]? = pigeonVar_list[24] as? [AnEnum?: AnEnum?] - let objectMap: [AnyHashable?: Any?]? = nilOrValue(pigeonVar_list[25]) - let listMap: [Int64?: [Any?]?]? = nilOrValue(pigeonVar_list[26]) - let mapMap: [Int64?: [AnyHashable?: Any?]?]? = nilOrValue(pigeonVar_list[27]) - - return AllNullableTypesWithoutRecursion( - aNullableBool: aNullableBool, - aNullableInt: aNullableInt, - aNullableInt64: aNullableInt64, - aNullableDouble: aNullableDouble, - aNullableByteArray: aNullableByteArray, - aNullable4ByteArray: aNullable4ByteArray, - aNullable8ByteArray: aNullable8ByteArray, - aNullableFloatArray: aNullableFloatArray, - aNullableEnum: aNullableEnum, - anotherNullableEnum: anotherNullableEnum, - aNullableString: aNullableString, - aNullableObject: aNullableObject, - list: list, - stringList: stringList, - intList: intList, - doubleList: doubleList, - boolList: boolList, - enumList: enumList, - objectList: objectList, - listList: listList, - mapList: mapList, - map: map, - stringMap: stringMap, - intMap: intMap, - enumMap: enumMap, - objectMap: objectMap, - listMap: listMap, - mapMap: mapMap - ) - } - func toList() -> [Any?] { - return [ - aNullableBool, - aNullableInt, - aNullableInt64, - aNullableDouble, - aNullableByteArray, - aNullable4ByteArray, - aNullable8ByteArray, - aNullableFloatArray, - aNullableEnum, - anotherNullableEnum, - aNullableString, - aNullableObject, - list, - stringList, - intList, - doubleList, - boolList, - enumList, - objectList, - listList, - mapList, - map, - stringMap, - intMap, - enumMap, - objectMap, - listMap, - mapMap, - ] - } - static func == (lhs: AllNullableTypesWithoutRecursion, rhs: AllNullableTypesWithoutRecursion) - -> Bool - { - return deepEqualsCoreTests(lhs.toList(), rhs.toList()) - } - func hash(into hasher: inout Hasher) { - deepHashCoreTests(value: toList(), hasher: &hasher) - } -} - -/// A class for testing nested class handling. -/// -/// This is needed to test nested nullable and non-nullable classes, -/// `AllNullableTypes` is non-nullable here as it is easier to instantiate -/// than `AllTypes` when testing doesn't require both (ie. testing null classes). -/// -/// Generated class from Pigeon that represents data sent in messages. -struct AllClassesWrapper: Hashable { - var allNullableTypes: AllNullableTypes - var allNullableTypesWithoutRecursion: AllNullableTypesWithoutRecursion? = nil - var allTypes: AllTypes? = nil - var classList: [AllTypes?] - var nullableClassList: [AllNullableTypesWithoutRecursion?]? = nil - var classMap: [Int64?: AllTypes?] - var nullableClassMap: [Int64?: AllNullableTypesWithoutRecursion?]? = nil - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> AllClassesWrapper? { - let allNullableTypes = pigeonVar_list[0] as! AllNullableTypes - let allNullableTypesWithoutRecursion: AllNullableTypesWithoutRecursion? = nilOrValue( - pigeonVar_list[1]) - let allTypes: AllTypes? = nilOrValue(pigeonVar_list[2]) - let classList = pigeonVar_list[3] as! [AllTypes?] - let nullableClassList: [AllNullableTypesWithoutRecursion?]? = nilOrValue(pigeonVar_list[4]) - let classMap = pigeonVar_list[5] as! [Int64?: AllTypes?] - let nullableClassMap: [Int64?: AllNullableTypesWithoutRecursion?]? = nilOrValue( - pigeonVar_list[6]) - - return AllClassesWrapper( - allNullableTypes: allNullableTypes, - allNullableTypesWithoutRecursion: allNullableTypesWithoutRecursion, - allTypes: allTypes, - classList: classList, - nullableClassList: nullableClassList, - classMap: classMap, - nullableClassMap: nullableClassMap - ) - } - func toList() -> [Any?] { - return [ - allNullableTypes, - allNullableTypesWithoutRecursion, - allTypes, - classList, - nullableClassList, - classMap, - nullableClassMap, - ] - } - static func == (lhs: AllClassesWrapper, rhs: AllClassesWrapper) -> Bool { - return deepEqualsCoreTests(lhs.toList(), rhs.toList()) - } - func hash(into hasher: inout Hasher) { - deepHashCoreTests(value: toList(), hasher: &hasher) - } -} - -/// A data class containing a List, used in unit tests. -/// -/// Generated class from Pigeon that represents data sent in messages. -struct TestMessage: Hashable { - var testList: [Any?]? = nil - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> TestMessage? { - let testList: [Any?]? = nilOrValue(pigeonVar_list[0]) - - return TestMessage( - testList: testList - ) - } - func toList() -> [Any?] { - return [ - testList - ] - } - static func == (lhs: TestMessage, rhs: TestMessage) -> Bool { - return deepEqualsCoreTests(lhs.toList(), rhs.toList()) - } - func hash(into hasher: inout Hasher) { - deepHashCoreTests(value: toList(), hasher: &hasher) - } -} - -private class CoreTestsPigeonCodecReader: FlutterStandardReader { - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 129: - let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) - if let enumResultAsInt = enumResultAsInt { - return AnEnum(rawValue: enumResultAsInt) - } - return nil - case 130: - let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) - if let enumResultAsInt = enumResultAsInt { - return AnotherEnum(rawValue: enumResultAsInt) - } - return nil - case 131: - return UnusedClass.fromList(self.readValue() as! [Any?]) - case 132: - return AllTypes.fromList(self.readValue() as! [Any?]) - case 133: - return AllNullableTypes.fromList(self.readValue() as! [Any?]) - case 134: - return AllNullableTypesWithoutRecursion.fromList(self.readValue() as! [Any?]) - case 135: - return AllClassesWrapper.fromList(self.readValue() as! [Any?]) - case 136: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) - } - } -} - -private class CoreTestsPigeonCodecWriter: FlutterStandardWriter { - override func writeValue(_ value: Any) { - if let value = value as? AnEnum { - super.writeByte(129) - super.writeValue(value.rawValue) - } else if let value = value as? AnotherEnum { - super.writeByte(130) - super.writeValue(value.rawValue) - } else if let value = value as? UnusedClass { - super.writeByte(131) - super.writeValue(value.toList()) - } else if let value = value as? AllTypes { - super.writeByte(132) - super.writeValue(value.toList()) - } else if let value = value as? AllNullableTypes { - super.writeByte(133) - super.writeValue(value.toList()) - } else if let value = value as? AllNullableTypesWithoutRecursion { - super.writeByte(134) - super.writeValue(value.toList()) - } else if let value = value as? AllClassesWrapper { - super.writeByte(135) - super.writeValue(value.toList()) - } else if let value = value as? TestMessage { - super.writeByte(136) - super.writeValue(value.toList()) - } else { - super.writeValue(value) - } - } -} - -private class CoreTestsPigeonCodecReaderWriter: FlutterStandardReaderWriter { - override func reader(with data: Data) -> FlutterStandardReader { - return CoreTestsPigeonCodecReader(data: data) - } - - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return CoreTestsPigeonCodecWriter(data: data) - } -} - -class CoreTestsPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = CoreTestsPigeonCodec(readerWriter: CoreTestsPigeonCodecReaderWriter()) -} - -/// The core interface that each host language plugin must implement in -/// platform_test integration tests. -/// -/// Generated protocol from Pigeon that represents a handler of messages from Flutter. -protocol HostIntegrationCoreApi { - /// A no-op function taking no arguments and returning no value, to sanity - /// test basic calling. - func noop() throws - /// Returns the passed object, to test serialization and deserialization. - func echo(_ everything: AllTypes) throws -> AllTypes - /// Returns an error, to test error handling. - func throwError() throws -> Any? - /// Returns an error from a void function, to test error handling. - func throwErrorFromVoid() throws - /// Returns a Flutter error, to test error handling. - func throwFlutterError() throws -> Any? - /// Returns passed in int. - func echo(_ anInt: Int64) throws -> Int64 - /// Returns passed in double. - func echo(_ aDouble: Double) throws -> Double - /// Returns the passed in boolean. - func echo(_ aBool: Bool) throws -> Bool - /// Returns the passed in string. - func echo(_ aString: String) throws -> String - /// Returns the passed in Uint8List. - func echo(_ aUint8List: FlutterStandardTypedData) throws -> FlutterStandardTypedData - /// Returns the passed in generic Object. - func echo(_ anObject: Any) throws -> Any - /// Returns the passed list, to test serialization and deserialization. - func echo(_ list: [Any?]) throws -> [Any?] - /// Returns the passed list, to test serialization and deserialization. - func echo(enumList: [AnEnum?]) throws -> [AnEnum?] - /// Returns the passed list, to test serialization and deserialization. - func echo(classList: [AllNullableTypes?]) throws -> [AllNullableTypes?] - /// Returns the passed list, to test serialization and deserialization. - func echoNonNull(enumList: [AnEnum]) throws -> [AnEnum] - /// Returns the passed list, to test serialization and deserialization. - func echoNonNull(classList: [AllNullableTypes]) throws -> [AllNullableTypes] - /// Returns the passed map, to test serialization and deserialization. - func echo(_ map: [AnyHashable?: Any?]) throws -> [AnyHashable?: Any?] - /// Returns the passed map, to test serialization and deserialization. - func echo(stringMap: [String?: String?]) throws -> [String?: String?] - /// Returns the passed map, to test serialization and deserialization. - func echo(intMap: [Int64?: Int64?]) throws -> [Int64?: Int64?] - /// Returns the passed map, to test serialization and deserialization. - func echo(enumMap: [AnEnum?: AnEnum?]) throws -> [AnEnum?: AnEnum?] - /// Returns the passed map, to test serialization and deserialization. - func echo(classMap: [Int64?: AllNullableTypes?]) throws -> [Int64?: AllNullableTypes?] - /// Returns the passed map, to test serialization and deserialization. - func echoNonNull(stringMap: [String: String]) throws -> [String: String] - /// Returns the passed map, to test serialization and deserialization. - func echoNonNull(intMap: [Int64: Int64]) throws -> [Int64: Int64] - /// Returns the passed map, to test serialization and deserialization. - func echoNonNull(enumMap: [AnEnum: AnEnum]) throws -> [AnEnum: AnEnum] - /// Returns the passed map, to test serialization and deserialization. - func echoNonNull(classMap: [Int64: AllNullableTypes]) throws -> [Int64: AllNullableTypes] - /// Returns the passed class to test nested class serialization and deserialization. - func echo(_ wrapper: AllClassesWrapper) throws -> AllClassesWrapper - /// Returns the passed enum to test serialization and deserialization. - func echo(_ anEnum: AnEnum) throws -> AnEnum - /// Returns the passed enum to test serialization and deserialization. - func echo(_ anotherEnum: AnotherEnum) throws -> AnotherEnum - /// Returns the default string. - func echoNamedDefault(_ aString: String) throws -> String - /// Returns passed in double. - func echoOptionalDefault(_ aDouble: Double) throws -> Double - /// Returns passed in int. - func echoRequired(_ anInt: Int64) throws -> Int64 - /// Returns the passed object, to test serialization and deserialization. - func echo(_ everything: AllNullableTypes?) throws -> AllNullableTypes? - /// Returns the passed object, to test serialization and deserialization. - func echo(_ everything: AllNullableTypesWithoutRecursion?) throws - -> AllNullableTypesWithoutRecursion? - /// Returns the inner `aString` value from the wrapped object, to test - /// sending of nested objects. - func extractNestedNullableString(from wrapper: AllClassesWrapper) throws -> String? - /// Returns the inner `aString` value from the wrapped object, to test - /// 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 - /// Returns passed in arguments of multiple types. - func sendMultipleNullableTypesWithoutRecursion( - aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String? - ) throws -> AllNullableTypesWithoutRecursion - /// Returns passed in int. - func echo(_ aNullableInt: Int64?) throws -> Int64? - /// Returns passed in double. - func echo(_ aNullableDouble: Double?) throws -> Double? - /// Returns the passed in boolean. - func echo(_ aNullableBool: Bool?) throws -> Bool? - /// Returns the passed in string. - func echo(_ aNullableString: String?) throws -> String? - /// Returns the passed in Uint8List. - func echo(_ aNullableUint8List: FlutterStandardTypedData?) throws -> FlutterStandardTypedData? - /// Returns the passed in generic Object. - func echo(_ aNullableObject: Any?) throws -> Any? - /// Returns the passed list, to test serialization and deserialization. - func echoNullable(_ aNullableList: [Any?]?) throws -> [Any?]? - /// Returns the passed list, to test serialization and deserialization. - func echoNullable(enumList: [AnEnum?]?) throws -> [AnEnum?]? - /// Returns the passed list, to test serialization and deserialization. - func echoNullable(classList: [AllNullableTypes?]?) throws -> [AllNullableTypes?]? - /// Returns the passed list, to test serialization and deserialization. - func echoNullableNonNull(enumList: [AnEnum]?) throws -> [AnEnum]? - /// Returns the passed list, to test serialization and deserialization. - func echoNullableNonNull(classList: [AllNullableTypes]?) throws -> [AllNullableTypes]? - /// Returns the passed map, to test serialization and deserialization. - func echoNullable(_ map: [AnyHashable?: Any?]?) throws -> [AnyHashable?: Any?]? - /// Returns the passed map, to test serialization and deserialization. - func echoNullable(stringMap: [String?: String?]?) throws -> [String?: String?]? - /// Returns the passed map, to test serialization and deserialization. - func echoNullable(intMap: [Int64?: Int64?]?) throws -> [Int64?: Int64?]? - /// Returns the passed map, to test serialization and deserialization. - func echoNullable(enumMap: [AnEnum?: AnEnum?]?) throws -> [AnEnum?: AnEnum?]? - /// Returns the passed map, to test serialization and deserialization. - func echoNullable(classMap: [Int64?: AllNullableTypes?]?) throws -> [Int64?: AllNullableTypes?]? - /// Returns the passed map, to test serialization and deserialization. - func echoNullableNonNull(stringMap: [String: String]?) throws -> [String: String]? - /// Returns the passed map, to test serialization and deserialization. - func echoNullableNonNull(intMap: [Int64: Int64]?) throws -> [Int64: Int64]? - /// Returns the passed map, to test serialization and deserialization. - func echoNullableNonNull(enumMap: [AnEnum: AnEnum]?) throws -> [AnEnum: AnEnum]? - /// Returns the passed map, to test serialization and deserialization. - func echoNullableNonNull(classMap: [Int64: AllNullableTypes]?) throws -> [Int64: - AllNullableTypes]? - func echoNullable(_ anEnum: AnEnum?) throws -> AnEnum? - func echoNullable(_ anotherEnum: AnotherEnum?) throws -> AnotherEnum? - /// Returns passed in int. - func echoOptional(_ aNullableInt: Int64?) throws -> Int64? - /// Returns the passed in string. - func echoNamed(_ aNullableString: String?) throws -> String? - /// A no-op function taking no arguments and returning no value, to sanity - /// test basic asynchronous calling. - func noopAsync(completion: @escaping (Result) -> Void) - /// Returns passed in int asynchronously. - func echoAsync(_ anInt: Int64, completion: @escaping (Result) -> Void) - /// Returns passed in double asynchronously. - func echoAsync(_ aDouble: Double, completion: @escaping (Result) -> Void) - /// Returns the passed in boolean asynchronously. - func echoAsync(_ aBool: Bool, completion: @escaping (Result) -> Void) - /// 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) - /// 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(_ list: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) - /// Returns the passed list, to test asynchronous serialization and deserialization. - func echoAsync(enumList: [AnEnum?], completion: @escaping (Result<[AnEnum?], Error>) -> Void) - /// Returns the passed list, to test asynchronous serialization and deserialization. - func echoAsync( - classList: [AllNullableTypes?], - completion: @escaping (Result<[AllNullableTypes?], Error>) -> Void) - /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsync( - _ map: [AnyHashable?: Any?], completion: @escaping (Result<[AnyHashable?: Any?], Error>) -> Void - ) - /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsync( - stringMap: [String?: String?], completion: @escaping (Result<[String?: String?], Error>) -> Void - ) - /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsync( - intMap: [Int64?: Int64?], completion: @escaping (Result<[Int64?: Int64?], Error>) -> Void) - /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsync( - enumMap: [AnEnum?: AnEnum?], completion: @escaping (Result<[AnEnum?: AnEnum?], Error>) -> Void) - /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsync( - classMap: [Int64?: AllNullableTypes?], - completion: @escaping (Result<[Int64?: AllNullableTypes?], Error>) -> Void) - /// Returns the passed enum, to test asynchronous serialization and deserialization. - func echoAsync(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) - /// Returns the passed enum, to test asynchronous serialization and deserialization. - func echoAsync( - _ anotherEnum: AnotherEnum, completion: @escaping (Result) -> Void) - /// Responds with an error from an async function returning a value. - func throwAsyncError(completion: @escaping (Result) -> Void) - /// Responds with an error from an async void function. - func throwAsyncErrorFromVoid(completion: @escaping (Result) -> Void) - /// Responds with a Flutter error from an async function returning a value. - func throwAsyncFlutterError(completion: @escaping (Result) -> Void) - /// 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) - /// Returns the passed object, to test serialization and deserialization. - func echoAsync( - _ everything: AllNullableTypesWithoutRecursion?, - completion: @escaping (Result) -> Void) - /// Returns passed in int asynchronously. - func echoAsyncNullable(_ anInt: Int64?, completion: @escaping (Result) -> Void) - /// Returns passed in double asynchronously. - func echoAsyncNullable(_ aDouble: Double?, completion: @escaping (Result) -> Void) - /// Returns the passed in boolean asynchronously. - func echoAsyncNullable(_ aBool: Bool?, completion: @escaping (Result) -> Void) - /// 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) - /// 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(_ list: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) - /// Returns the passed list, to test asynchronous serialization and deserialization. - func echoAsyncNullable( - enumList: [AnEnum?]?, completion: @escaping (Result<[AnEnum?]?, Error>) -> Void) - /// Returns the passed list, to test asynchronous serialization and deserialization. - func echoAsyncNullable( - classList: [AllNullableTypes?]?, - completion: @escaping (Result<[AllNullableTypes?]?, Error>) -> Void) - /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsyncNullable( - _ map: [AnyHashable?: Any?]?, - completion: @escaping (Result<[AnyHashable?: Any?]?, Error>) -> Void) - /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsyncNullable( - stringMap: [String?: String?]?, - completion: @escaping (Result<[String?: String?]?, Error>) -> Void) - /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsyncNullable( - intMap: [Int64?: Int64?]?, completion: @escaping (Result<[Int64?: Int64?]?, Error>) -> Void) - /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsyncNullable( - enumMap: [AnEnum?: AnEnum?]?, completion: @escaping (Result<[AnEnum?: AnEnum?]?, Error>) -> Void - ) - /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsyncNullable( - classMap: [Int64?: AllNullableTypes?]?, - completion: @escaping (Result<[Int64?: AllNullableTypes?]?, Error>) -> Void) - /// Returns the passed enum, to test asynchronous serialization and deserialization. - func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result) -> Void) - /// Returns the passed enum, to test asynchronous serialization and deserialization. - func echoAsyncNullable( - _ anotherEnum: AnotherEnum?, completion: @escaping (Result) -> Void) - /// Returns true if the handler is run on a main thread, which should be - /// true since there is no TaskQueue annotation. - func defaultIsMainThread() throws -> Bool - /// Returns true if the handler is run on a non-main thread, which should be - /// true for any platform with TaskQueue support. - func taskQueueIsBackgroundThread() throws -> Bool - 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: AllNullableTypesWithoutRecursion?, - completion: @escaping (Result) -> Void) - func callFlutterSendMultipleNullableTypesWithoutRecursion( - 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( - _ list: FlutterStandardTypedData, - completion: @escaping (Result) -> Void) - func callFlutterEcho(_ list: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) - func callFlutterEcho( - enumList: [AnEnum?], completion: @escaping (Result<[AnEnum?], Error>) -> Void) - func callFlutterEcho( - classList: [AllNullableTypes?], - completion: @escaping (Result<[AllNullableTypes?], Error>) -> Void) - func callFlutterEchoNonNull( - enumList: [AnEnum], completion: @escaping (Result<[AnEnum], Error>) -> Void) - func callFlutterEchoNonNull( - classList: [AllNullableTypes], completion: @escaping (Result<[AllNullableTypes], Error>) -> Void - ) - func callFlutterEcho( - _ map: [AnyHashable?: Any?], completion: @escaping (Result<[AnyHashable?: Any?], Error>) -> Void - ) - func callFlutterEcho( - stringMap: [String?: String?], completion: @escaping (Result<[String?: String?], Error>) -> Void - ) - func callFlutterEcho( - intMap: [Int64?: Int64?], completion: @escaping (Result<[Int64?: Int64?], Error>) -> Void) - func callFlutterEcho( - enumMap: [AnEnum?: AnEnum?], completion: @escaping (Result<[AnEnum?: AnEnum?], Error>) -> Void) - func callFlutterEcho( - classMap: [Int64?: AllNullableTypes?], - completion: @escaping (Result<[Int64?: AllNullableTypes?], Error>) -> Void) - func callFlutterEchoNonNull( - stringMap: [String: String], completion: @escaping (Result<[String: String], Error>) -> Void) - func callFlutterEchoNonNull( - intMap: [Int64: Int64], completion: @escaping (Result<[Int64: Int64], Error>) -> Void) - func callFlutterEchoNonNull( - enumMap: [AnEnum: AnEnum], completion: @escaping (Result<[AnEnum: AnEnum], Error>) -> Void) - func callFlutterEchoNonNull( - classMap: [Int64: AllNullableTypes], - completion: @escaping (Result<[Int64: AllNullableTypes], Error>) -> Void) - func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result) -> Void) - func callFlutterEcho( - _ anotherEnum: AnotherEnum, 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( - _ list: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void) - func callFlutterEchoNullable( - _ list: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) - func callFlutterEchoNullable( - enumList: [AnEnum?]?, completion: @escaping (Result<[AnEnum?]?, Error>) -> Void) - func callFlutterEchoNullable( - classList: [AllNullableTypes?]?, - completion: @escaping (Result<[AllNullableTypes?]?, Error>) -> Void) - func callFlutterEchoNullableNonNull( - enumList: [AnEnum]?, completion: @escaping (Result<[AnEnum]?, Error>) -> Void) - func callFlutterEchoNullableNonNull( - classList: [AllNullableTypes]?, - completion: @escaping (Result<[AllNullableTypes]?, Error>) -> Void) - func callFlutterEchoNullable( - _ map: [AnyHashable?: Any?]?, - completion: @escaping (Result<[AnyHashable?: Any?]?, Error>) -> Void) - func callFlutterEchoNullable( - stringMap: [String?: String?]?, - completion: @escaping (Result<[String?: String?]?, Error>) -> Void) - func callFlutterEchoNullable( - intMap: [Int64?: Int64?]?, completion: @escaping (Result<[Int64?: Int64?]?, Error>) -> Void) - func callFlutterEchoNullable( - enumMap: [AnEnum?: AnEnum?]?, completion: @escaping (Result<[AnEnum?: AnEnum?]?, Error>) -> Void - ) - func callFlutterEchoNullable( - classMap: [Int64?: AllNullableTypes?]?, - completion: @escaping (Result<[Int64?: AllNullableTypes?]?, Error>) -> Void) - func callFlutterEchoNullableNonNull( - stringMap: [String: String]?, completion: @escaping (Result<[String: String]?, Error>) -> Void) - func callFlutterEchoNullableNonNull( - intMap: [Int64: Int64]?, completion: @escaping (Result<[Int64: Int64]?, Error>) -> Void) - func callFlutterEchoNullableNonNull( - enumMap: [AnEnum: AnEnum]?, completion: @escaping (Result<[AnEnum: AnEnum]?, Error>) -> Void) - func callFlutterEchoNullableNonNull( - classMap: [Int64: AllNullableTypes]?, - completion: @escaping (Result<[Int64: AllNullableTypes]?, Error>) -> Void) - func callFlutterEchoNullable( - _ anEnum: AnEnum?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullable( - _ anotherEnum: AnotherEnum?, completion: @escaping (Result) -> Void) - func callFlutterSmallApiEcho( - _ aString: String, completion: @escaping (Result) -> Void) -} - -/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. -class HostIntegrationCoreApiSetup { - static var codec: FlutterStandardMessageCodec { CoreTestsPigeonCodec.shared } - /// Sets up an instance of `HostIntegrationCoreApi` to handle messages through the `binaryMessenger`. - static func setUp( - binaryMessenger: FlutterBinaryMessenger, api: HostIntegrationCoreApi?, - messageChannelSuffix: String = "" - ) { - let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - #if os(iOS) - let taskQueue = binaryMessenger.makeBackgroundTaskQueue?() - #else - let taskQueue: FlutterTaskQueue? = nil - #endif - /// 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\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - noopChannel.setMessageHandler { _, reply in - do { - try api.noop() - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - noopChannel.setMessageHandler(nil) - } - /// Returns the passed object, to test serialization and deserialization. - let echoAllTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAllTypesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let everythingArg = args[0] as! AllTypes - do { - let result = try api.echo(everythingArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoAllTypesChannel.setMessageHandler(nil) - } - /// Returns an error, to test error handling. - let throwErrorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - throwErrorChannel.setMessageHandler { _, reply in - do { - let result = try api.throwError() - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - 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\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - throwErrorFromVoidChannel.setMessageHandler { _, reply in - do { - try api.throwErrorFromVoid() - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - throwErrorFromVoidChannel.setMessageHandler(nil) - } - /// Returns a Flutter error, to test error handling. - let throwFlutterErrorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - throwFlutterErrorChannel.setMessageHandler { _, reply in - do { - let result = try api.throwFlutterError() - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - throwFlutterErrorChannel.setMessageHandler(nil) - } - /// Returns passed in int. - let echoIntChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoIntChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anIntArg = args[0] as! Int64 - do { - let result = try api.echo(anIntArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoIntChannel.setMessageHandler(nil) - } - /// Returns passed in double. - let echoDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoDoubleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aDoubleArg = args[0] as! Double - do { - let result = try api.echo(aDoubleArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoDoubleChannel.setMessageHandler(nil) - } - /// Returns the passed in boolean. - let echoBoolChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoBoolChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aBoolArg = args[0] as! Bool - do { - let result = try api.echo(aBoolArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoBoolChannel.setMessageHandler(nil) - } - /// Returns the passed in string. - let echoStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aStringArg = args[0] as! String - do { - let result = try api.echo(aStringArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoStringChannel.setMessageHandler(nil) - } - /// Returns the passed in Uint8List. - let echoUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoUint8ListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aUint8ListArg = args[0] as! FlutterStandardTypedData - do { - let result = try api.echo(aUint8ListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoUint8ListChannel.setMessageHandler(nil) - } - /// Returns the passed in generic Object. - let echoObjectChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoObjectChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anObjectArg = args[0]! - do { - let result = try api.echo(anObjectArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoObjectChannel.setMessageHandler(nil) - } - /// Returns the passed list, to test serialization and deserialization. - let echoListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let listArg = args[0] as! [Any?] - do { - let result = try api.echo(listArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoListChannel.setMessageHandler(nil) - } - /// Returns the passed list, to test serialization and deserialization. - let echoEnumListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnumList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoEnumListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumListArg = args[0] as! [AnEnum?] - do { - let result = try api.echo(enumList: enumListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoEnumListChannel.setMessageHandler(nil) - } - /// Returns the passed list, to test serialization and deserialization. - let echoClassListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoClassListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classListArg = args[0] as! [AllNullableTypes?] - do { - let result = try api.echo(classList: classListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoClassListChannel.setMessageHandler(nil) - } - /// Returns the passed list, to test serialization and deserialization. - let echoNonNullEnumListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNonNullEnumList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNonNullEnumListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumListArg = args[0] as! [AnEnum] - do { - let result = try api.echoNonNull(enumList: enumListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNonNullEnumListChannel.setMessageHandler(nil) - } - /// Returns the passed list, to test serialization and deserialization. - let echoNonNullClassListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNonNullClassList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNonNullClassListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classListArg = args[0] as! [AllNullableTypes] - do { - let result = try api.echoNonNull(classList: classListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNonNullClassListChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let mapArg = args[0] as! [AnyHashable?: Any?] - do { - let result = try api.echo(mapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoStringMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoStringMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoStringMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let stringMapArg = args[0] as! [String?: String?] - do { - let result = try api.echo(stringMap: stringMapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoStringMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoIntMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoIntMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoIntMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let intMapArg = args[0] as! [Int64?: Int64?] - do { - let result = try api.echo(intMap: intMapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoIntMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoEnumMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnumMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoEnumMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumMapArg = args[0] as? [AnEnum?: AnEnum?] - do { - let result = try api.echo(enumMap: enumMapArg!) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoEnumMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoClassMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoClassMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classMapArg = args[0] as! [Int64?: AllNullableTypes?] - do { - let result = try api.echo(classMap: classMapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoClassMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoNonNullStringMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNonNullStringMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNonNullStringMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let stringMapArg = args[0] as! [String: String] - do { - let result = try api.echoNonNull(stringMap: stringMapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNonNullStringMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoNonNullIntMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNonNullIntMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNonNullIntMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let intMapArg = args[0] as! [Int64: Int64] - do { - let result = try api.echoNonNull(intMap: intMapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNonNullIntMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoNonNullEnumMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNonNullEnumMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNonNullEnumMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumMapArg = args[0] as? [AnEnum: AnEnum] - do { - let result = try api.echoNonNull(enumMap: enumMapArg!) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNonNullEnumMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoNonNullClassMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNonNullClassMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNonNullClassMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classMapArg = args[0] as! [Int64: AllNullableTypes] - do { - let result = try api.echoNonNull(classMap: classMapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNonNullClassMapChannel.setMessageHandler(nil) - } - /// Returns the passed class to test nested class serialization and deserialization. - let echoClassWrapperChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoClassWrapperChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let wrapperArg = args[0] as! AllClassesWrapper - do { - let result = try api.echo(wrapperArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoClassWrapperChannel.setMessageHandler(nil) - } - /// Returns the passed enum to test serialization and deserialization. - let echoEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anEnumArg = args[0] as! AnEnum - do { - let result = try api.echo(anEnumArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoEnumChannel.setMessageHandler(nil) - } - /// Returns the passed enum to test serialization and deserialization. - let echoAnotherEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherEnum\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAnotherEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anotherEnumArg = args[0] as! AnotherEnum - do { - let result = try api.echo(anotherEnumArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoAnotherEnumChannel.setMessageHandler(nil) - } - /// Returns the default string. - let echoNamedDefaultStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNamedDefaultStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aStringArg = args[0] as! String - do { - let result = try api.echoNamedDefault(aStringArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNamedDefaultStringChannel.setMessageHandler(nil) - } - /// Returns passed in double. - let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoOptionalDefaultDoubleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aDoubleArg = args[0] as! Double - do { - let result = try api.echoOptionalDefault(aDoubleArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoOptionalDefaultDoubleChannel.setMessageHandler(nil) - } - /// Returns passed in int. - let echoRequiredIntChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoRequiredIntChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anIntArg = args[0] as! Int64 - do { - let result = try api.echoRequired(anIntArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoRequiredIntChannel.setMessageHandler(nil) - } - /// Returns the passed object, to test serialization and deserialization. - let echoAllNullableTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAllNullableTypesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let everythingArg: AllNullableTypes? = nilOrValue(args[0]) - do { - let result = try api.echo(everythingArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoAllNullableTypesChannel.setMessageHandler(nil) - } - /// Returns the passed object, to test serialization and deserialization. - let echoAllNullableTypesWithoutRecursionChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypesWithoutRecursion\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAllNullableTypesWithoutRecursionChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let everythingArg: AllNullableTypesWithoutRecursion? = nilOrValue(args[0]) - do { - let result = try api.echo(everythingArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoAllNullableTypesWithoutRecursionChannel.setMessageHandler(nil) - } - /// 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\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - extractNestedNullableStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let wrapperArg = args[0] as! AllClassesWrapper - do { - let result = try api.extractNestedNullableString(from: wrapperArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - extractNestedNullableStringChannel.setMessageHandler(nil) - } - /// 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\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - createNestedNullableStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let nullableStringArg: String? = nilOrValue(args[0]) - do { - let result = try api.createNestedObject(with: nullableStringArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - createNestedNullableStringChannel.setMessageHandler(nil) - } - /// Returns passed in arguments of multiple types. - let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes\(channelSuffix)", - 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? = nilOrValue(args[1]) - let aNullableStringArg: String? = nilOrValue(args[2]) - do { - let result = try api.sendMultipleNullableTypes( - aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - sendMultipleNullableTypesChannel.setMessageHandler(nil) - } - /// Returns passed in arguments of multiple types. - let sendMultipleNullableTypesWithoutRecursionChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypesWithoutRecursion\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - sendMultipleNullableTypesWithoutRecursionChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = nilOrValue(args[1]) - let aNullableStringArg: String? = nilOrValue(args[2]) - do { - let result = try api.sendMultipleNullableTypesWithoutRecursion( - aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - sendMultipleNullableTypesWithoutRecursionChannel.setMessageHandler(nil) - } - /// Returns passed in int. - let echoNullableIntChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableIntChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aNullableIntArg: Int64? = nilOrValue(args[0]) - do { - let result = try api.echo(aNullableIntArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableIntChannel.setMessageHandler(nil) - } - /// Returns passed in double. - let echoNullableDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableDoubleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aNullableDoubleArg: Double? = nilOrValue(args[0]) - do { - let result = try api.echo(aNullableDoubleArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableDoubleChannel.setMessageHandler(nil) - } - /// Returns the passed in boolean. - let echoNullableBoolChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableBoolChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aNullableBoolArg: Bool? = nilOrValue(args[0]) - do { - let result = try api.echo(aNullableBoolArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableBoolChannel.setMessageHandler(nil) - } - /// Returns the passed in string. - let echoNullableStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aNullableStringArg: String? = nilOrValue(args[0]) - do { - let result = try api.echo(aNullableStringArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableStringChannel.setMessageHandler(nil) - } - /// Returns the passed in Uint8List. - let echoNullableUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableUint8ListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aNullableUint8ListArg: FlutterStandardTypedData? = nilOrValue(args[0]) - do { - let result = try api.echo(aNullableUint8ListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableUint8ListChannel.setMessageHandler(nil) - } - /// Returns the passed in generic Object. - let echoNullableObjectChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableObjectChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aNullableObjectArg: Any? = args[0] - do { - let result = try api.echo(aNullableObjectArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableObjectChannel.setMessageHandler(nil) - } - /// Returns the passed list, to test serialization and deserialization. - let echoNullableListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aNullableListArg: [Any?]? = nilOrValue(args[0]) - do { - let result = try api.echoNullable(aNullableListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableListChannel.setMessageHandler(nil) - } - /// Returns the passed list, to test serialization and deserialization. - let echoNullableEnumListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnumList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableEnumListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumListArg: [AnEnum?]? = nilOrValue(args[0]) - do { - let result = try api.echoNullable(enumList: enumListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableEnumListChannel.setMessageHandler(nil) - } - /// Returns the passed list, to test serialization and deserialization. - let echoNullableClassListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableClassList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableClassListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classListArg: [AllNullableTypes?]? = nilOrValue(args[0]) - do { - let result = try api.echoNullable(classList: classListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableClassListChannel.setMessageHandler(nil) - } - /// Returns the passed list, to test serialization and deserialization. - let echoNullableNonNullEnumListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableNonNullEnumList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableNonNullEnumListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumListArg: [AnEnum]? = nilOrValue(args[0]) - do { - let result = try api.echoNullableNonNull(enumList: enumListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableNonNullEnumListChannel.setMessageHandler(nil) - } - /// Returns the passed list, to test serialization and deserialization. - let echoNullableNonNullClassListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableNonNullClassList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableNonNullClassListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classListArg: [AllNullableTypes]? = nilOrValue(args[0]) - do { - let result = try api.echoNullableNonNull(classList: classListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableNonNullClassListChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoNullableMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let mapArg: [AnyHashable?: Any?]? = nilOrValue(args[0]) - do { - let result = try api.echoNullable(mapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoNullableStringMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableStringMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableStringMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let stringMapArg: [String?: String?]? = nilOrValue(args[0]) - do { - let result = try api.echoNullable(stringMap: stringMapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableStringMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoNullableIntMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableIntMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableIntMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let intMapArg: [Int64?: Int64?]? = nilOrValue(args[0]) - do { - let result = try api.echoNullable(intMap: intMapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableIntMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoNullableEnumMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnumMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableEnumMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumMapArg: [AnEnum?: AnEnum?]? = args[0] as? [AnEnum?: AnEnum?] - do { - let result = try api.echoNullable(enumMap: enumMapArg!) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableEnumMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoNullableClassMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableClassMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableClassMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classMapArg: [Int64?: AllNullableTypes?]? = nilOrValue(args[0]) - do { - let result = try api.echoNullable(classMap: classMapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableClassMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoNullableNonNullStringMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableNonNullStringMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableNonNullStringMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let stringMapArg: [String: String]? = nilOrValue(args[0]) - do { - let result = try api.echoNullableNonNull(stringMap: stringMapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableNonNullStringMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoNullableNonNullIntMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableNonNullIntMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableNonNullIntMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let intMapArg: [Int64: Int64]? = nilOrValue(args[0]) - do { - let result = try api.echoNullableNonNull(intMap: intMapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableNonNullIntMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoNullableNonNullEnumMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableNonNullEnumMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableNonNullEnumMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumMapArg: [AnEnum: AnEnum]? = args[0] as? [AnEnum: AnEnum] - do { - let result = try api.echoNullableNonNull(enumMap: enumMapArg!) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableNonNullEnumMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test serialization and deserialization. - let echoNullableNonNullClassMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableNonNullClassMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableNonNullClassMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classMapArg: [Int64: AllNullableTypes]? = nilOrValue(args[0]) - do { - let result = try api.echoNullableNonNull(classMap: classMapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableNonNullClassMapChannel.setMessageHandler(nil) - } - let echoNullableEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anEnumArg: AnEnum? = nilOrValue(args[0]) - do { - let result = try api.echoNullable(anEnumArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableEnumChannel.setMessageHandler(nil) - } - let echoAnotherNullableEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherNullableEnum\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAnotherNullableEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anotherEnumArg: AnotherEnum? = nilOrValue(args[0]) - do { - let result = try api.echoNullable(anotherEnumArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoAnotherNullableEnumChannel.setMessageHandler(nil) - } - /// Returns passed in int. - let echoOptionalNullableIntChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoOptionalNullableIntChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aNullableIntArg: Int64? = nilOrValue(args[0]) - do { - let result = try api.echoOptional(aNullableIntArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoOptionalNullableIntChannel.setMessageHandler(nil) - } - /// Returns the passed in string. - let echoNamedNullableStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNamedNullableStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aNullableStringArg: String? = nilOrValue(args[0]) - do { - let result = try api.echoNamed(aNullableStringArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNamedNullableStringChannel.setMessageHandler(nil) - } - /// 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\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - noopAsyncChannel.setMessageHandler { _, reply in - api.noopAsync { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - noopAsyncChannel.setMessageHandler(nil) - } - /// Returns passed in int asynchronously. - let echoAsyncIntChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncIntChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anIntArg = args[0] as! Int64 - api.echoAsync(anIntArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncIntChannel.setMessageHandler(nil) - } - /// Returns passed in double asynchronously. - let echoAsyncDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncDoubleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - echoAsyncDoubleChannel.setMessageHandler(nil) - } - /// Returns the passed in boolean asynchronously. - let echoAsyncBoolChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncBoolChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - echoAsyncBoolChannel.setMessageHandler(nil) - } - /// Returns the passed string asynchronously. - let echoAsyncStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - echoAsyncStringChannel.setMessageHandler(nil) - } - /// Returns the passed in Uint8List asynchronously. - let echoAsyncUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncUint8ListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - echoAsyncUint8ListChannel.setMessageHandler(nil) - } - /// Returns the passed in generic Object asynchronously. - let echoAsyncObjectChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncObjectChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - 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\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let listArg = args[0] as! [Any?] - api.echoAsync(listArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncListChannel.setMessageHandler(nil) - } - /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncEnumListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnumList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncEnumListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumListArg = args[0] as! [AnEnum?] - api.echoAsync(enumList: enumListArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncEnumListChannel.setMessageHandler(nil) - } - /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncClassListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncClassList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncClassListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classListArg = args[0] as! [AllNullableTypes?] - api.echoAsync(classList: classListArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncClassListChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let mapArg = args[0] as! [AnyHashable?: Any?] - api.echoAsync(mapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncStringMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncStringMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncStringMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let stringMapArg = args[0] as! [String?: String?] - api.echoAsync(stringMap: stringMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncStringMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncIntMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncIntMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncIntMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let intMapArg = args[0] as! [Int64?: Int64?] - api.echoAsync(intMap: intMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncIntMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncEnumMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnumMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncEnumMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumMapArg = args[0] as? [AnEnum?: AnEnum?] - api.echoAsync(enumMap: enumMapArg!) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncEnumMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncClassMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncClassMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncClassMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classMapArg = args[0] as! [Int64?: AllNullableTypes?] - api.echoAsync(classMap: classMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncClassMapChannel.setMessageHandler(nil) - } - /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anEnumArg = args[0] as! AnEnum - api.echoAsync(anEnumArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncEnumChannel.setMessageHandler(nil) - } - /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAnotherAsyncEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherAsyncEnum\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAnotherAsyncEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anotherEnumArg = args[0] as! AnotherEnum - api.echoAsync(anotherEnumArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAnotherAsyncEnumChannel.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\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - throwAsyncErrorChannel.setMessageHandler { _, reply in - api.throwAsyncError { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - throwAsyncErrorChannel.setMessageHandler(nil) - } - /// Responds with an error from an async void function. - let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - throwAsyncErrorFromVoidChannel.setMessageHandler { _, reply in - api.throwAsyncErrorFromVoid { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - 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\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - throwAsyncFlutterErrorChannel.setMessageHandler { _, reply in - api.throwAsyncFlutterError { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - 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\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncAllTypesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - echoAsyncAllTypesChannel.setMessageHandler(nil) - } - /// Returns the passed object, to test serialization and deserialization. - let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableAllNullableTypesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - echoAsyncNullableAllNullableTypesChannel.setMessageHandler(nil) - } - /// Returns the passed object, to test serialization and deserialization. - let echoAsyncNullableAllNullableTypesWithoutRecursionChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypesWithoutRecursion\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableAllNullableTypesWithoutRecursionChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let everythingArg: AllNullableTypesWithoutRecursion? = nilOrValue(args[0]) - api.echoAsync(everythingArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableAllNullableTypesWithoutRecursionChannel.setMessageHandler(nil) - } - /// Returns passed in int asynchronously. - let echoAsyncNullableIntChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableIntChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anIntArg: Int64? = nilOrValue(args[0]) - api.echoAsyncNullable(anIntArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableIntChannel.setMessageHandler(nil) - } - /// Returns passed in double asynchronously. - let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableDoubleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - echoAsyncNullableDoubleChannel.setMessageHandler(nil) - } - /// Returns the passed in boolean asynchronously. - let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableBoolChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - echoAsyncNullableBoolChannel.setMessageHandler(nil) - } - /// Returns the passed string asynchronously. - let echoAsyncNullableStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - echoAsyncNullableStringChannel.setMessageHandler(nil) - } - /// Returns the passed in Uint8List asynchronously. - let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableUint8ListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - echoAsyncNullableUint8ListChannel.setMessageHandler(nil) - } - /// Returns the passed in generic Object asynchronously. - let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableObjectChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - 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\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let listArg: [Any?]? = nilOrValue(args[0]) - api.echoAsyncNullable(listArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableListChannel.setMessageHandler(nil) - } - /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncNullableEnumListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnumList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableEnumListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumListArg: [AnEnum?]? = nilOrValue(args[0]) - api.echoAsyncNullable(enumList: enumListArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableEnumListChannel.setMessageHandler(nil) - } - /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncNullableClassListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableClassList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableClassListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classListArg: [AllNullableTypes?]? = nilOrValue(args[0]) - api.echoAsyncNullable(classList: classListArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableClassListChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncNullableMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let mapArg: [AnyHashable?: Any?]? = nilOrValue(args[0]) - api.echoAsyncNullable(mapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncNullableStringMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableStringMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableStringMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let stringMapArg: [String?: String?]? = nilOrValue(args[0]) - api.echoAsyncNullable(stringMap: stringMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableStringMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncNullableIntMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableIntMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableIntMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let intMapArg: [Int64?: Int64?]? = nilOrValue(args[0]) - api.echoAsyncNullable(intMap: intMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableIntMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncNullableEnumMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnumMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableEnumMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumMapArg: [AnEnum?: AnEnum?]? = args[0] as? [AnEnum?: AnEnum?] - api.echoAsyncNullable(enumMap: enumMapArg!) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableEnumMapChannel.setMessageHandler(nil) - } - /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncNullableClassMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableClassMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableClassMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classMapArg: [Int64?: AllNullableTypes?]? = nilOrValue(args[0]) - api.echoAsyncNullable(classMap: classMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableClassMapChannel.setMessageHandler(nil) - } - /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anEnumArg: AnEnum? = nilOrValue(args[0]) - api.echoAsyncNullable(anEnumArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableEnumChannel.setMessageHandler(nil) - } - /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAnotherAsyncNullableEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAnotherAsyncNullableEnum\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAnotherAsyncNullableEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anotherEnumArg: AnotherEnum? = nilOrValue(args[0]) - api.echoAsyncNullable(anotherEnumArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAnotherAsyncNullableEnumChannel.setMessageHandler(nil) - } - /// Returns true if the handler is run on a main thread, which should be - /// true since there is no TaskQueue annotation. - let defaultIsMainThreadChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.defaultIsMainThread\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - defaultIsMainThreadChannel.setMessageHandler { _, reply in - do { - let result = try api.defaultIsMainThread() - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - defaultIsMainThreadChannel.setMessageHandler(nil) - } - /// Returns true if the handler is run on a non-main thread, which should be - /// true for any platform with TaskQueue support. - let taskQueueIsBackgroundThreadChannel = - taskQueue == nil - ? FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.taskQueueIsBackgroundThread\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - : FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.taskQueueIsBackgroundThread\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec, taskQueue: taskQueue) - if let api = api { - taskQueueIsBackgroundThreadChannel.setMessageHandler { _, reply in - do { - let result = try api.taskQueueIsBackgroundThread() - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - taskQueueIsBackgroundThreadChannel.setMessageHandler(nil) - } - let callFlutterNoopChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterNoopChannel.setMessageHandler { _, reply in - api.callFlutterNoop { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterNoopChannel.setMessageHandler(nil) - } - let callFlutterThrowErrorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterThrowErrorChannel.setMessageHandler { _, reply in - api.callFlutterThrowError { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterThrowErrorChannel.setMessageHandler(nil) - } - let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterThrowErrorFromVoidChannel.setMessageHandler { _, reply in - api.callFlutterThrowErrorFromVoid { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterThrowErrorFromVoidChannel.setMessageHandler(nil) - } - let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - callFlutterEchoAllTypesChannel.setMessageHandler(nil) - } - let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoAllNullableTypesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - callFlutterEchoAllNullableTypesChannel.setMessageHandler(nil) - } - let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes\(channelSuffix)", - 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? = nilOrValue(args[1]) - 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)) - } - } - } - } else { - callFlutterSendMultipleNullableTypesChannel.setMessageHandler(nil) - } - let callFlutterEchoAllNullableTypesWithoutRecursionChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypesWithoutRecursion\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoAllNullableTypesWithoutRecursionChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let everythingArg: AllNullableTypesWithoutRecursion? = nilOrValue(args[0]) - api.callFlutterEcho(everythingArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoAllNullableTypesWithoutRecursionChannel.setMessageHandler(nil) - } - let callFlutterSendMultipleNullableTypesWithoutRecursionChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypesWithoutRecursion\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterSendMultipleNullableTypesWithoutRecursionChannel.setMessageHandler { - message, reply in - let args = message as! [Any?] - let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = nilOrValue(args[1]) - let aNullableStringArg: String? = nilOrValue(args[2]) - api.callFlutterSendMultipleNullableTypesWithoutRecursion( - aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterSendMultipleNullableTypesWithoutRecursionChannel.setMessageHandler(nil) - } - let callFlutterEchoBoolChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoBoolChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - callFlutterEchoBoolChannel.setMessageHandler(nil) - } - let callFlutterEchoIntChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoIntChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anIntArg = args[0] as! Int64 - api.callFlutterEcho(anIntArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoIntChannel.setMessageHandler(nil) - } - let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoDoubleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - callFlutterEchoDoubleChannel.setMessageHandler(nil) - } - let callFlutterEchoStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - callFlutterEchoStringChannel.setMessageHandler(nil) - } - let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let listArg = args[0] as! FlutterStandardTypedData - api.callFlutterEcho(listArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoUint8ListChannel.setMessageHandler(nil) - } - let callFlutterEchoListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let listArg = args[0] as! [Any?] - api.callFlutterEcho(listArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoListChannel.setMessageHandler(nil) - } - let callFlutterEchoEnumListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnumList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoEnumListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumListArg = args[0] as! [AnEnum?] - api.callFlutterEcho(enumList: enumListArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoEnumListChannel.setMessageHandler(nil) - } - let callFlutterEchoClassListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoClassList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoClassListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classListArg = args[0] as! [AllNullableTypes?] - api.callFlutterEcho(classList: classListArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoClassListChannel.setMessageHandler(nil) - } - let callFlutterEchoNonNullEnumListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNonNullEnumList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNonNullEnumListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumListArg = args[0] as! [AnEnum] - api.callFlutterEchoNonNull(enumList: enumListArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNonNullEnumListChannel.setMessageHandler(nil) - } - let callFlutterEchoNonNullClassListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNonNullClassList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNonNullClassListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classListArg = args[0] as! [AllNullableTypes] - api.callFlutterEchoNonNull(classList: classListArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNonNullClassListChannel.setMessageHandler(nil) - } - let callFlutterEchoMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let mapArg = args[0] as! [AnyHashable?: Any?] - api.callFlutterEcho(mapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoMapChannel.setMessageHandler(nil) - } - let callFlutterEchoStringMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoStringMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoStringMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let stringMapArg = args[0] as! [String?: String?] - api.callFlutterEcho(stringMap: stringMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoStringMapChannel.setMessageHandler(nil) - } - let callFlutterEchoIntMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoIntMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoIntMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let intMapArg = args[0] as! [Int64?: Int64?] - api.callFlutterEcho(intMap: intMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoIntMapChannel.setMessageHandler(nil) - } - let callFlutterEchoEnumMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnumMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoEnumMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumMapArg = args[0] as? [AnEnum?: AnEnum?] - api.callFlutterEcho(enumMap: enumMapArg!) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoEnumMapChannel.setMessageHandler(nil) - } - let callFlutterEchoClassMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoClassMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoClassMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classMapArg = args[0] as! [Int64?: AllNullableTypes?] - api.callFlutterEcho(classMap: classMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoClassMapChannel.setMessageHandler(nil) - } - let callFlutterEchoNonNullStringMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNonNullStringMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNonNullStringMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let stringMapArg = args[0] as! [String: String] - api.callFlutterEchoNonNull(stringMap: stringMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNonNullStringMapChannel.setMessageHandler(nil) - } - let callFlutterEchoNonNullIntMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNonNullIntMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNonNullIntMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let intMapArg = args[0] as! [Int64: Int64] - api.callFlutterEchoNonNull(intMap: intMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNonNullIntMapChannel.setMessageHandler(nil) - } - let callFlutterEchoNonNullEnumMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNonNullEnumMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNonNullEnumMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumMapArg = args[0] as? [AnEnum: AnEnum] - api.callFlutterEchoNonNull(enumMap: enumMapArg!) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNonNullEnumMapChannel.setMessageHandler(nil) - } - let callFlutterEchoNonNullClassMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNonNullClassMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNonNullClassMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classMapArg = args[0] as! [Int64: AllNullableTypes] - api.callFlutterEchoNonNull(classMap: classMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNonNullClassMapChannel.setMessageHandler(nil) - } - let callFlutterEchoEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anEnumArg = args[0] as! AnEnum - api.callFlutterEcho(anEnumArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoEnumChannel.setMessageHandler(nil) - } - let callFlutterEchoAnotherEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAnotherEnum\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoAnotherEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anotherEnumArg = args[0] as! AnotherEnum - api.callFlutterEcho(anotherEnumArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoAnotherEnumChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - callFlutterEchoNullableBoolChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anIntArg: Int64? = nilOrValue(args[0]) - api.callFlutterEchoNullable(anIntArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableIntChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - callFlutterEchoNullableDoubleChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - callFlutterEchoNullableStringChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let listArg: FlutterStandardTypedData? = nilOrValue(args[0]) - api.callFlutterEchoNullable(listArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableUint8ListChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let listArg: [Any?]? = nilOrValue(args[0]) - api.callFlutterEchoNullable(listArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableListChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableEnumListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnumList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableEnumListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumListArg: [AnEnum?]? = nilOrValue(args[0]) - api.callFlutterEchoNullable(enumList: enumListArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableEnumListChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableClassListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableClassList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableClassListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classListArg: [AllNullableTypes?]? = nilOrValue(args[0]) - api.callFlutterEchoNullable(classList: classListArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableClassListChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableNonNullEnumListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableNonNullEnumList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableNonNullEnumListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumListArg: [AnEnum]? = nilOrValue(args[0]) - api.callFlutterEchoNullableNonNull(enumList: enumListArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableNonNullEnumListChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableNonNullClassListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableNonNullClassList\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableNonNullClassListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classListArg: [AllNullableTypes]? = nilOrValue(args[0]) - api.callFlutterEchoNullableNonNull(classList: classListArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableNonNullClassListChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let mapArg: [AnyHashable?: Any?]? = nilOrValue(args[0]) - api.callFlutterEchoNullable(mapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableMapChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableStringMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableStringMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableStringMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let stringMapArg: [String?: String?]? = nilOrValue(args[0]) - api.callFlutterEchoNullable(stringMap: stringMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableStringMapChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableIntMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableIntMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableIntMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let intMapArg: [Int64?: Int64?]? = nilOrValue(args[0]) - api.callFlutterEchoNullable(intMap: intMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableIntMapChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableEnumMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnumMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableEnumMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumMapArg: [AnEnum?: AnEnum?]? = args[0] as? [AnEnum?: AnEnum?] - api.callFlutterEchoNullable(enumMap: enumMapArg!) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableEnumMapChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableClassMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableClassMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableClassMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classMapArg: [Int64?: AllNullableTypes?]? = nilOrValue(args[0]) - api.callFlutterEchoNullable(classMap: classMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableClassMapChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableNonNullStringMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableNonNullStringMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableNonNullStringMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let stringMapArg: [String: String]? = nilOrValue(args[0]) - api.callFlutterEchoNullableNonNull(stringMap: stringMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableNonNullStringMapChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableNonNullIntMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableNonNullIntMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableNonNullIntMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let intMapArg: [Int64: Int64]? = nilOrValue(args[0]) - api.callFlutterEchoNullableNonNull(intMap: intMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableNonNullIntMapChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableNonNullEnumMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableNonNullEnumMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableNonNullEnumMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let enumMapArg: [AnEnum: AnEnum]? = args[0] as? [AnEnum: AnEnum] - api.callFlutterEchoNullableNonNull(enumMap: enumMapArg!) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableNonNullEnumMapChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableNonNullClassMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableNonNullClassMap\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableNonNullClassMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let classMapArg: [Int64: AllNullableTypes]? = nilOrValue(args[0]) - api.callFlutterEchoNullableNonNull(classMap: classMapArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableNonNullClassMapChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anEnumArg: AnEnum? = nilOrValue(args[0]) - api.callFlutterEchoNullable(anEnumArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableEnumChannel.setMessageHandler(nil) - } - let callFlutterEchoAnotherNullableEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAnotherNullableEnum\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoAnotherNullableEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let anotherEnumArg: AnotherEnum? = nilOrValue(args[0]) - api.callFlutterEchoNullable(anotherEnumArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoAnotherNullableEnumChannel.setMessageHandler(nil) - } - let callFlutterSmallApiEchoStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSmallApiEchoString\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterSmallApiEchoStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aStringArg = args[0] as! String - api.callFlutterSmallApiEcho(aStringArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterSmallApiEchoStringChannel.setMessageHandler(nil) - } - } -} -/// The core interface that the Dart platform_test code implements for host -/// integration tests to call into. -/// -/// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. -protocol FlutterIntegrationCoreApiProtocol { - /// A no-op function taking no arguments and returning no value, to sanity - /// test basic calling. - func noop(completion: @escaping (Result) -> Void) - /// Responds with an error from an async function returning a value. - func throwError(completion: @escaping (Result) -> Void) - /// 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) - /// Returns the passed object, to test serialization and deserialization. - 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) - /// Returns the passed object, to test serialization and deserialization. - func echoNullable( - _ everythingArg: AllNullableTypesWithoutRecursion?, - completion: @escaping (Result) -> Void) - /// Returns passed in arguments of multiple types. - /// - /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypesWithoutRecursion( - 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. - func echo(_ anIntArg: Int64, completion: @escaping (Result) -> Void) - /// Returns the passed double, to test serialization and deserialization. - func echo(_ aDoubleArg: Double, completion: @escaping (Result) -> Void) - /// 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( - _ listArg: FlutterStandardTypedData, - completion: @escaping (Result) -> Void) - /// Returns the passed list, to test serialization and deserialization. - func echo(_ listArg: [Any?], completion: @escaping (Result<[Any?], PigeonError>) -> Void) - /// Returns the passed list, to test serialization and deserialization. - func echo( - enumList enumListArg: [AnEnum?], completion: @escaping (Result<[AnEnum?], PigeonError>) -> Void) - /// Returns the passed list, to test serialization and deserialization. - func echo( - classList classListArg: [AllNullableTypes?], - completion: @escaping (Result<[AllNullableTypes?], PigeonError>) -> Void) - /// Returns the passed list, to test serialization and deserialization. - func echoNonNull( - enumList enumListArg: [AnEnum], completion: @escaping (Result<[AnEnum], PigeonError>) -> Void) - /// Returns the passed list, to test serialization and deserialization. - func echoNonNull( - classList classListArg: [AllNullableTypes], - completion: @escaping (Result<[AllNullableTypes], PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echo( - _ mapArg: [AnyHashable?: Any?], - completion: @escaping (Result<[AnyHashable?: Any?], PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echo( - stringMap stringMapArg: [String?: String?], - completion: @escaping (Result<[String?: String?], PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echo( - intMap intMapArg: [Int64?: Int64?], - completion: @escaping (Result<[Int64?: Int64?], PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echo( - enumMap enumMapArg: [AnEnum?: AnEnum?], - completion: @escaping (Result<[AnEnum?: AnEnum?], PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echo( - classMap classMapArg: [Int64?: AllNullableTypes?], - completion: @escaping (Result<[Int64?: AllNullableTypes?], PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echoNonNull( - stringMap stringMapArg: [String: String], - completion: @escaping (Result<[String: String], PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echoNonNull( - intMap intMapArg: [Int64: Int64], - completion: @escaping (Result<[Int64: Int64], PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echoNonNull( - enumMap enumMapArg: [AnEnum: AnEnum], - completion: @escaping (Result<[AnEnum: AnEnum], PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echoNonNull( - classMap classMapArg: [Int64: AllNullableTypes], - completion: @escaping (Result<[Int64: AllNullableTypes], PigeonError>) -> Void) - /// Returns the passed enum to test serialization and deserialization. - func echo(_ anEnumArg: AnEnum, completion: @escaping (Result) -> Void) - /// Returns the passed enum to test serialization and deserialization. - func echo( - _ anotherEnumArg: AnotherEnum, 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) - /// Returns the passed double, to test serialization and deserialization. - 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) - /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable( - _ listArg: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void) - /// Returns the passed list, to test serialization and deserialization. - func echoNullable( - _ listArg: [Any?]?, completion: @escaping (Result<[Any?]?, PigeonError>) -> Void) - /// Returns the passed list, to test serialization and deserialization. - func echoNullable( - enumList enumListArg: [AnEnum?]?, - completion: @escaping (Result<[AnEnum?]?, PigeonError>) -> Void) - /// Returns the passed list, to test serialization and deserialization. - func echoNullable( - classList classListArg: [AllNullableTypes?]?, - completion: @escaping (Result<[AllNullableTypes?]?, PigeonError>) -> Void) - /// Returns the passed list, to test serialization and deserialization. - func echoNullableNonNull( - enumList enumListArg: [AnEnum]?, completion: @escaping (Result<[AnEnum]?, PigeonError>) -> Void) - /// Returns the passed list, to test serialization and deserialization. - func echoNullableNonNull( - classList classListArg: [AllNullableTypes]?, - completion: @escaping (Result<[AllNullableTypes]?, PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echoNullable( - _ mapArg: [AnyHashable?: Any?]?, - completion: @escaping (Result<[AnyHashable?: Any?]?, PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echoNullable( - stringMap stringMapArg: [String?: String?]?, - completion: @escaping (Result<[String?: String?]?, PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echoNullable( - intMap intMapArg: [Int64?: Int64?]?, - completion: @escaping (Result<[Int64?: Int64?]?, PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echoNullable( - enumMap enumMapArg: [AnEnum?: AnEnum?]?, - completion: @escaping (Result<[AnEnum?: AnEnum?]?, PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echoNullable( - classMap classMapArg: [Int64?: AllNullableTypes?]?, - completion: @escaping (Result<[Int64?: AllNullableTypes?]?, PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echoNullableNonNull( - stringMap stringMapArg: [String: String]?, - completion: @escaping (Result<[String: String]?, PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echoNullableNonNull( - intMap intMapArg: [Int64: Int64]?, - completion: @escaping (Result<[Int64: Int64]?, PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echoNullableNonNull( - enumMap enumMapArg: [AnEnum: AnEnum]?, - completion: @escaping (Result<[AnEnum: AnEnum]?, PigeonError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func echoNullableNonNull( - classMap classMapArg: [Int64: AllNullableTypes]?, - completion: @escaping (Result<[Int64: AllNullableTypes]?, PigeonError>) -> Void) - /// Returns the passed enum to test serialization and deserialization. - func echoNullable( - _ anEnumArg: AnEnum?, completion: @escaping (Result) -> Void) - /// Returns the passed enum to test serialization and deserialization. - func echoNullable( - _ anotherEnumArg: AnotherEnum?, - 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) - /// Returns the passed in generic Object asynchronously. - func echoAsync(_ aStringArg: String, completion: @escaping (Result) -> Void) -} -class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { - private let binaryMessenger: FlutterBinaryMessenger - private let messageChannelSuffix: String - init(binaryMessenger: FlutterBinaryMessenger, messageChannelSuffix: String = "") { - self.binaryMessenger = binaryMessenger - self.messageChannelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - } - var codec: CoreTestsPigeonCodec { - return CoreTestsPigeonCodec.shared - } - /// 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\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(())) - } - } - } - /// 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\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: Any? = listResponse[0] - completion(.success(result)) - } - } - } - /// 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\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(())) - } - } - } - /// 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\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - 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)) - } - } - } - /// 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\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: AllNullableTypes? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// 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\(messageChannelSuffix)" - 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 - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - 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)) - } - } - } - /// Returns the passed object, to test serialization and deserialization. - func echoNullable( - _ everythingArg: AllNullableTypesWithoutRecursion?, - completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypesWithoutRecursion\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: AllNullableTypesWithoutRecursion? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// Returns passed in arguments of multiple types. - /// - /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypesWithoutRecursion( - aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, - aString aNullableStringArg: String?, - completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypesWithoutRecursion\(messageChannelSuffix)" - 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 - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! AllNullableTypesWithoutRecursion - completion(.success(result)) - } - } - } - /// 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\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - 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)) - } - } - } - /// 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\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! Int64 - 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\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - 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)) - } - } - } - /// 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\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - 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)) - } - } - } - /// Returns the passed byte list, to test serialization and deserialization. - func echo( - _ listArg: FlutterStandardTypedData, - completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([listArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - 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)) - } - } - } - /// Returns the passed list, to test serialization and deserialization. - func echo(_ listArg: [Any?], completion: @escaping (Result<[Any?], PigeonError>) -> Void) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([listArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - 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)) - } - } - } - /// Returns the passed list, to test serialization and deserialization. - func echo( - enumList enumListArg: [AnEnum?], completion: @escaping (Result<[AnEnum?], PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnumList\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([enumListArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! [AnEnum?] - completion(.success(result)) - } - } - } - /// Returns the passed list, to test serialization and deserialization. - func echo( - classList classListArg: [AllNullableTypes?], - completion: @escaping (Result<[AllNullableTypes?], PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoClassList\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([classListArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - 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)) - } - } - } - /// Returns the passed list, to test serialization and deserialization. - func echoNonNull( - enumList enumListArg: [AnEnum], completion: @escaping (Result<[AnEnum], PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNonNullEnumList\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([enumListArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! [AnEnum] - completion(.success(result)) - } - } - } - /// Returns the passed list, to test serialization and deserialization. - func echoNonNull( - classList classListArg: [AllNullableTypes], - completion: @escaping (Result<[AllNullableTypes], PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNonNullClassList\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([classListArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - 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)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echo( - _ mapArg: [AnyHashable?: Any?], - completion: @escaping (Result<[AnyHashable?: Any?], PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([mapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! [AnyHashable?: Any?] - completion(.success(result)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echo( - stringMap stringMapArg: [String?: String?], - completion: @escaping (Result<[String?: String?], PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoStringMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([stringMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! [String?: String?] - completion(.success(result)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echo( - intMap intMapArg: [Int64?: Int64?], - completion: @escaping (Result<[Int64?: Int64?], PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoIntMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([intMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! [Int64?: Int64?] - completion(.success(result)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echo( - enumMap enumMapArg: [AnEnum?: AnEnum?], - completion: @escaping (Result<[AnEnum?: AnEnum?], PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnumMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([enumMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as? [AnEnum?: AnEnum?] - completion(.success(result!)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echo( - classMap classMapArg: [Int64?: AllNullableTypes?], - completion: @escaping (Result<[Int64?: AllNullableTypes?], PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoClassMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([classMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! [Int64?: AllNullableTypes?] - completion(.success(result)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echoNonNull( - stringMap stringMapArg: [String: String], - completion: @escaping (Result<[String: String], PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNonNullStringMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([stringMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! [String: String] - completion(.success(result)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echoNonNull( - intMap intMapArg: [Int64: Int64], - completion: @escaping (Result<[Int64: Int64], PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNonNullIntMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([intMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! [Int64: Int64] - completion(.success(result)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echoNonNull( - enumMap enumMapArg: [AnEnum: AnEnum], - completion: @escaping (Result<[AnEnum: AnEnum], PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNonNullEnumMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([enumMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as? [AnEnum: AnEnum] - completion(.success(result!)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echoNonNull( - classMap classMapArg: [Int64: AllNullableTypes], - completion: @escaping (Result<[Int64: AllNullableTypes], PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNonNullClassMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([classMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! [Int64: AllNullableTypes] - completion(.success(result)) - } - } - } - /// 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\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([anEnumArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! AnEnum - completion(.success(result)) - } - } - } - /// Returns the passed enum to test serialization and deserialization. - func echo( - _ anotherEnumArg: AnotherEnum, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherEnum\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([anotherEnumArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! AnotherEnum - completion(.success(result)) - } - } - } - /// 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\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: Bool? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// 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\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: Int64? = nilOrValue(listResponse[0]) - 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\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: Double? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// 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\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: String? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable( - _ listArg: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([listArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: FlutterStandardTypedData? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// Returns the passed list, to test serialization and deserialization. - func echoNullable( - _ listArg: [Any?]?, completion: @escaping (Result<[Any?]?, PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([listArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: [Any?]? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// Returns the passed list, to test serialization and deserialization. - func echoNullable( - enumList enumListArg: [AnEnum?]?, - completion: @escaping (Result<[AnEnum?]?, PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnumList\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([enumListArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: [AnEnum?]? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// Returns the passed list, to test serialization and deserialization. - func echoNullable( - classList classListArg: [AllNullableTypes?]?, - completion: @escaping (Result<[AllNullableTypes?]?, PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableClassList\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([classListArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: [AllNullableTypes?]? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// Returns the passed list, to test serialization and deserialization. - func echoNullableNonNull( - enumList enumListArg: [AnEnum]?, completion: @escaping (Result<[AnEnum]?, PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableNonNullEnumList\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([enumListArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: [AnEnum]? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// Returns the passed list, to test serialization and deserialization. - func echoNullableNonNull( - classList classListArg: [AllNullableTypes]?, - completion: @escaping (Result<[AllNullableTypes]?, PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableNonNullClassList\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([classListArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: [AllNullableTypes]? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echoNullable( - _ mapArg: [AnyHashable?: Any?]?, - completion: @escaping (Result<[AnyHashable?: Any?]?, PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([mapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: [AnyHashable?: Any?]? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echoNullable( - stringMap stringMapArg: [String?: String?]?, - completion: @escaping (Result<[String?: String?]?, PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableStringMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([stringMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: [String?: String?]? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echoNullable( - intMap intMapArg: [Int64?: Int64?]?, - completion: @escaping (Result<[Int64?: Int64?]?, PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableIntMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([intMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: [Int64?: Int64?]? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echoNullable( - enumMap enumMapArg: [AnEnum?: AnEnum?]?, - completion: @escaping (Result<[AnEnum?: AnEnum?]?, PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnumMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([enumMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: [AnEnum?: AnEnum?]? = listResponse[0] as? [AnEnum?: AnEnum?] - completion(.success(result!)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echoNullable( - classMap classMapArg: [Int64?: AllNullableTypes?]?, - completion: @escaping (Result<[Int64?: AllNullableTypes?]?, PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableClassMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([classMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: [Int64?: AllNullableTypes?]? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echoNullableNonNull( - stringMap stringMapArg: [String: String]?, - completion: @escaping (Result<[String: String]?, PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableNonNullStringMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([stringMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: [String: String]? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echoNullableNonNull( - intMap intMapArg: [Int64: Int64]?, - completion: @escaping (Result<[Int64: Int64]?, PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableNonNullIntMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([intMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: [Int64: Int64]? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echoNullableNonNull( - enumMap enumMapArg: [AnEnum: AnEnum]?, - completion: @escaping (Result<[AnEnum: AnEnum]?, PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableNonNullEnumMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([enumMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: [AnEnum: AnEnum]? = listResponse[0] as? [AnEnum: AnEnum] - completion(.success(result!)) - } - } - } - /// Returns the passed map, to test serialization and deserialization. - func echoNullableNonNull( - classMap classMapArg: [Int64: AllNullableTypes]?, - completion: @escaping (Result<[Int64: AllNullableTypes]?, PigeonError>) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableNonNullClassMap\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([classMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: [Int64: AllNullableTypes]? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// 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\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([anEnumArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: AnEnum? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// Returns the passed enum to test serialization and deserialization. - func echoNullable( - _ anotherEnumArg: AnotherEnum?, - completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAnotherNullableEnum\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([anotherEnumArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - let result: AnotherEnum? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - /// 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\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(())) - } - } - } - /// 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\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - 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)) - } - } - } -} -/// An API that can be implemented for minimal, compile-only tests. -/// -/// Generated protocol from Pigeon that represents a handler of messages from Flutter. -protocol HostTrivialApi { - func noop() throws -} - -/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. -class HostTrivialApiSetup { - static var codec: FlutterStandardMessageCodec { CoreTestsPigeonCodec.shared } - /// Sets up an instance of `HostTrivialApi` to handle messages through the `binaryMessenger`. - static func setUp( - binaryMessenger: FlutterBinaryMessenger, api: HostTrivialApi?, messageChannelSuffix: String = "" - ) { - let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - let noopChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - noopChannel.setMessageHandler { _, reply in - do { - try api.noop() - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - noopChannel.setMessageHandler(nil) - } - } -} -/// A simple API implemented in some unit tests. -/// -/// Generated protocol from Pigeon that represents a handler of messages from Flutter. -protocol HostSmallApi { - func echo(aString: String, completion: @escaping (Result) -> Void) - func voidVoid(completion: @escaping (Result) -> Void) -} - -/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. -class HostSmallApiSetup { - static var codec: FlutterStandardMessageCodec { CoreTestsPigeonCodec.shared } - /// Sets up an instance of `HostSmallApi` to handle messages through the `binaryMessenger`. - static func setUp( - binaryMessenger: FlutterBinaryMessenger, api: HostSmallApi?, messageChannelSuffix: String = "" - ) { - let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - let echoChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - 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)) - } - } - } - } else { - echoChannel.setMessageHandler(nil) - } - let voidVoidChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid\(channelSuffix)", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - voidVoidChannel.setMessageHandler { _, reply in - api.voidVoid { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - voidVoidChannel.setMessageHandler(nil) - } - } -} -/// A simple API called in some unit tests. -/// -/// 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(string aStringArg: String, completion: @escaping (Result) -> Void) -} -class FlutterSmallApi: FlutterSmallApiProtocol { - private let binaryMessenger: FlutterBinaryMessenger - private let messageChannelSuffix: String - init(binaryMessenger: FlutterBinaryMessenger, messageChannelSuffix: String = "") { - self.binaryMessenger = binaryMessenger - self.messageChannelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - } - var codec: CoreTestsPigeonCodec { - return CoreTestsPigeonCodec.shared - } - func echo(_ msgArg: TestMessage, completion: @escaping (Result) -> Void) - { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - 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)) - } - } - } - func echo(string aStringArg: String, completion: @escaping (Result) -> Void) - { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString\(messageChannelSuffix)" - 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))) - return - } - 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(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - 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/EventChannelTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/EventChannelTests.gen.swift deleted file mode 100644 index 16b881e2ea5..00000000000 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/EventChannelTests.gen.swift +++ /dev/null @@ -1,707 +0,0 @@ -// 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 -#elseif os(macOS) - import FlutterMacOS -#else - #error("Unsupported platform.") -#endif - -/// Error class for passing custom error details to Dart side. -final class EventChannelTestsError: Error { - let code: String - let message: String? - let details: Sendable? - - init(code: String, message: String?, details: Sendable?) { - self.code = code - self.message = message - self.details = details - } - - var localizedDescription: String { - return - "EventChannelTestsError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" - } -} - -private func isNullish(_ value: Any?) -> Bool { - return value is NSNull || value == nil -} - -private func nilOrValue(_ value: Any?) -> T? { - if value is NSNull { return nil } - return value as! T? -} - -func deepEqualsEventChannelTests(_ lhs: Any?, _ rhs: Any?) -> Bool { - let cleanLhs = nilOrValue(lhs) as Any? - let cleanRhs = nilOrValue(rhs) as Any? - switch (cleanLhs, cleanRhs) { - case (nil, nil): - return true - - case (nil, _), (_, nil): - return false - - case is (Void, Void): - return true - - case let (cleanLhsHashable, cleanRhsHashable) as (AnyHashable, AnyHashable): - return cleanLhsHashable == cleanRhsHashable - - case let (cleanLhsArray, cleanRhsArray) as ([Any?], [Any?]): - guard cleanLhsArray.count == cleanRhsArray.count else { return false } - for (index, element) in cleanLhsArray.enumerated() { - if !deepEqualsEventChannelTests(element, cleanRhsArray[index]) { - return false - } - } - return true - - case let (cleanLhsDictionary, cleanRhsDictionary) as ([AnyHashable: Any?], [AnyHashable: Any?]): - guard cleanLhsDictionary.count == cleanRhsDictionary.count else { return false } - for (key, cleanLhsValue) in cleanLhsDictionary { - guard cleanRhsDictionary.index(forKey: key) != nil else { return false } - if !deepEqualsEventChannelTests(cleanLhsValue, cleanRhsDictionary[key]!) { - return false - } - } - return true - - default: - // Any other type shouldn't be able to be used with pigeon. File an issue if you find this to be untrue. - return false - } -} - -func deepHashEventChannelTests(value: Any?, hasher: inout Hasher) { - if let valueList = value as? [AnyHashable] { - for item in valueList { deepHashEventChannelTests(value: item, hasher: &hasher) } - return - } - - if let valueDict = value as? [AnyHashable: AnyHashable] { - for key in valueDict.keys { - hasher.combine(key) - deepHashEventChannelTests(value: valueDict[key]!, hasher: &hasher) - } - return - } - - if let hashableValue = value as? AnyHashable { - hasher.combine(hashableValue.hashValue) - } - - return hasher.combine(String(describing: value)) -} - -enum EventEnum: Int { - case one = 0 - case two = 1 - case three = 2 - case fortyTwo = 3 - case fourHundredTwentyTwo = 4 -} - -enum AnotherEventEnum: Int { - case justInCase = 0 -} - -/// A class containing all supported nullable types. -/// -/// Generated class from Pigeon that represents data sent in messages. -class EventAllNullableTypes: Hashable { - init( - aNullableBool: Bool? = nil, - aNullableInt: Int64? = nil, - aNullableInt64: Int64? = nil, - aNullableDouble: Double? = nil, - aNullableByteArray: FlutterStandardTypedData? = nil, - aNullable4ByteArray: FlutterStandardTypedData? = nil, - aNullable8ByteArray: FlutterStandardTypedData? = nil, - aNullableFloatArray: FlutterStandardTypedData? = nil, - aNullableEnum: EventEnum? = nil, - anotherNullableEnum: AnotherEventEnum? = nil, - aNullableString: String? = nil, - aNullableObject: Any? = nil, - allNullableTypes: EventAllNullableTypes? = nil, - list: [Any?]? = nil, - stringList: [String?]? = nil, - intList: [Int64?]? = nil, - doubleList: [Double?]? = nil, - boolList: [Bool?]? = nil, - enumList: [EventEnum?]? = nil, - objectList: [Any?]? = nil, - listList: [[Any?]?]? = nil, - mapList: [[AnyHashable?: Any?]?]? = nil, - recursiveClassList: [EventAllNullableTypes?]? = nil, - map: [AnyHashable?: Any?]? = nil, - stringMap: [String?: String?]? = nil, - intMap: [Int64?: Int64?]? = nil, - enumMap: [EventEnum?: EventEnum?]? = nil, - objectMap: [AnyHashable?: Any?]? = nil, - listMap: [Int64?: [Any?]?]? = nil, - mapMap: [Int64?: [AnyHashable?: Any?]?]? = nil, - recursiveClassMap: [Int64?: EventAllNullableTypes?]? = nil - ) { - self.aNullableBool = aNullableBool - self.aNullableInt = aNullableInt - self.aNullableInt64 = aNullableInt64 - self.aNullableDouble = aNullableDouble - self.aNullableByteArray = aNullableByteArray - self.aNullable4ByteArray = aNullable4ByteArray - self.aNullable8ByteArray = aNullable8ByteArray - self.aNullableFloatArray = aNullableFloatArray - self.aNullableEnum = aNullableEnum - self.anotherNullableEnum = anotherNullableEnum - self.aNullableString = aNullableString - self.aNullableObject = aNullableObject - self.allNullableTypes = allNullableTypes - self.list = list - self.stringList = stringList - self.intList = intList - self.doubleList = doubleList - self.boolList = boolList - self.enumList = enumList - self.objectList = objectList - self.listList = listList - self.mapList = mapList - self.recursiveClassList = recursiveClassList - self.map = map - self.stringMap = stringMap - self.intMap = intMap - self.enumMap = enumMap - self.objectMap = objectMap - self.listMap = listMap - self.mapMap = mapMap - self.recursiveClassMap = recursiveClassMap - } - var aNullableBool: Bool? - var aNullableInt: Int64? - var aNullableInt64: Int64? - var aNullableDouble: Double? - var aNullableByteArray: FlutterStandardTypedData? - var aNullable4ByteArray: FlutterStandardTypedData? - var aNullable8ByteArray: FlutterStandardTypedData? - var aNullableFloatArray: FlutterStandardTypedData? - var aNullableEnum: EventEnum? - var anotherNullableEnum: AnotherEventEnum? - var aNullableString: String? - var aNullableObject: Any? - var allNullableTypes: EventAllNullableTypes? - var list: [Any?]? - var stringList: [String?]? - var intList: [Int64?]? - var doubleList: [Double?]? - var boolList: [Bool?]? - var enumList: [EventEnum?]? - var objectList: [Any?]? - var listList: [[Any?]?]? - var mapList: [[AnyHashable?: Any?]?]? - var recursiveClassList: [EventAllNullableTypes?]? - var map: [AnyHashable?: Any?]? - var stringMap: [String?: String?]? - var intMap: [Int64?: Int64?]? - var enumMap: [EventEnum?: EventEnum?]? - var objectMap: [AnyHashable?: Any?]? - var listMap: [Int64?: [Any?]?]? - var mapMap: [Int64?: [AnyHashable?: Any?]?]? - var recursiveClassMap: [Int64?: EventAllNullableTypes?]? - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> EventAllNullableTypes? { - let aNullableBool: Bool? = nilOrValue(pigeonVar_list[0]) - let aNullableInt: Int64? = nilOrValue(pigeonVar_list[1]) - let aNullableInt64: Int64? = nilOrValue(pigeonVar_list[2]) - let aNullableDouble: Double? = nilOrValue(pigeonVar_list[3]) - let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[4]) - let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[5]) - let aNullable8ByteArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[6]) - let aNullableFloatArray: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[7]) - let aNullableEnum: EventEnum? = nilOrValue(pigeonVar_list[8]) - let anotherNullableEnum: AnotherEventEnum? = nilOrValue(pigeonVar_list[9]) - let aNullableString: String? = nilOrValue(pigeonVar_list[10]) - let aNullableObject: Any? = pigeonVar_list[11] - let allNullableTypes: EventAllNullableTypes? = nilOrValue(pigeonVar_list[12]) - let list: [Any?]? = nilOrValue(pigeonVar_list[13]) - let stringList: [String?]? = nilOrValue(pigeonVar_list[14]) - let intList: [Int64?]? = nilOrValue(pigeonVar_list[15]) - let doubleList: [Double?]? = nilOrValue(pigeonVar_list[16]) - let boolList: [Bool?]? = nilOrValue(pigeonVar_list[17]) - let enumList: [EventEnum?]? = nilOrValue(pigeonVar_list[18]) - let objectList: [Any?]? = nilOrValue(pigeonVar_list[19]) - let listList: [[Any?]?]? = nilOrValue(pigeonVar_list[20]) - let mapList: [[AnyHashable?: Any?]?]? = nilOrValue(pigeonVar_list[21]) - let recursiveClassList: [EventAllNullableTypes?]? = nilOrValue(pigeonVar_list[22]) - let map: [AnyHashable?: Any?]? = nilOrValue(pigeonVar_list[23]) - let stringMap: [String?: String?]? = nilOrValue(pigeonVar_list[24]) - let intMap: [Int64?: Int64?]? = nilOrValue(pigeonVar_list[25]) - let enumMap: [EventEnum?: EventEnum?]? = pigeonVar_list[26] as? [EventEnum?: EventEnum?] - let objectMap: [AnyHashable?: Any?]? = nilOrValue(pigeonVar_list[27]) - let listMap: [Int64?: [Any?]?]? = nilOrValue(pigeonVar_list[28]) - let mapMap: [Int64?: [AnyHashable?: Any?]?]? = nilOrValue(pigeonVar_list[29]) - let recursiveClassMap: [Int64?: EventAllNullableTypes?]? = nilOrValue(pigeonVar_list[30]) - - return EventAllNullableTypes( - aNullableBool: aNullableBool, - aNullableInt: aNullableInt, - aNullableInt64: aNullableInt64, - aNullableDouble: aNullableDouble, - aNullableByteArray: aNullableByteArray, - aNullable4ByteArray: aNullable4ByteArray, - aNullable8ByteArray: aNullable8ByteArray, - aNullableFloatArray: aNullableFloatArray, - aNullableEnum: aNullableEnum, - anotherNullableEnum: anotherNullableEnum, - aNullableString: aNullableString, - aNullableObject: aNullableObject, - allNullableTypes: allNullableTypes, - list: list, - stringList: stringList, - intList: intList, - doubleList: doubleList, - boolList: boolList, - enumList: enumList, - objectList: objectList, - listList: listList, - mapList: mapList, - recursiveClassList: recursiveClassList, - map: map, - stringMap: stringMap, - intMap: intMap, - enumMap: enumMap, - objectMap: objectMap, - listMap: listMap, - mapMap: mapMap, - recursiveClassMap: recursiveClassMap - ) - } - func toList() -> [Any?] { - return [ - aNullableBool, - aNullableInt, - aNullableInt64, - aNullableDouble, - aNullableByteArray, - aNullable4ByteArray, - aNullable8ByteArray, - aNullableFloatArray, - aNullableEnum, - anotherNullableEnum, - aNullableString, - aNullableObject, - allNullableTypes, - list, - stringList, - intList, - doubleList, - boolList, - enumList, - objectList, - listList, - mapList, - recursiveClassList, - map, - stringMap, - intMap, - enumMap, - objectMap, - listMap, - mapMap, - recursiveClassMap, - ] - } - static func == (lhs: EventAllNullableTypes, rhs: EventAllNullableTypes) -> Bool { - if lhs === rhs { - return true - } - return deepEqualsEventChannelTests(lhs.toList(), rhs.toList()) - } - func hash(into hasher: inout Hasher) { - deepHashEventChannelTests(value: toList(), hasher: &hasher) - } -} - -/// Generated class from Pigeon that represents data sent in messages. -/// This protocol should not be extended by any user class outside of the generated file. -protocol PlatformEvent { - -} - -/// Generated class from Pigeon that represents data sent in messages. -struct IntEvent: PlatformEvent { - var value: Int64 - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> IntEvent? { - let value = pigeonVar_list[0] as! Int64 - - return IntEvent( - value: value - ) - } - func toList() -> [Any?] { - return [ - value - ] - } - static func == (lhs: IntEvent, rhs: IntEvent) -> Bool { - return deepEqualsEventChannelTests(lhs.toList(), rhs.toList()) - } - func hash(into hasher: inout Hasher) { - deepHashEventChannelTests(value: toList(), hasher: &hasher) - } -} - -/// Generated class from Pigeon that represents data sent in messages. -struct StringEvent: PlatformEvent { - var value: String - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> StringEvent? { - let value = pigeonVar_list[0] as! String - - return StringEvent( - value: value - ) - } - func toList() -> [Any?] { - return [ - value - ] - } - static func == (lhs: StringEvent, rhs: StringEvent) -> Bool { - return deepEqualsEventChannelTests(lhs.toList(), rhs.toList()) - } - func hash(into hasher: inout Hasher) { - deepHashEventChannelTests(value: toList(), hasher: &hasher) - } -} - -/// Generated class from Pigeon that represents data sent in messages. -struct BoolEvent: PlatformEvent { - var value: Bool - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> BoolEvent? { - let value = pigeonVar_list[0] as! Bool - - return BoolEvent( - value: value - ) - } - func toList() -> [Any?] { - return [ - value - ] - } - static func == (lhs: BoolEvent, rhs: BoolEvent) -> Bool { - return deepEqualsEventChannelTests(lhs.toList(), rhs.toList()) - } - func hash(into hasher: inout Hasher) { - deepHashEventChannelTests(value: toList(), hasher: &hasher) - } -} - -/// Generated class from Pigeon that represents data sent in messages. -struct DoubleEvent: PlatformEvent { - var value: Double - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> DoubleEvent? { - let value = pigeonVar_list[0] as! Double - - return DoubleEvent( - value: value - ) - } - func toList() -> [Any?] { - return [ - value - ] - } - static func == (lhs: DoubleEvent, rhs: DoubleEvent) -> Bool { - return deepEqualsEventChannelTests(lhs.toList(), rhs.toList()) - } - func hash(into hasher: inout Hasher) { - deepHashEventChannelTests(value: toList(), hasher: &hasher) - } -} - -/// Generated class from Pigeon that represents data sent in messages. -struct ObjectsEvent: PlatformEvent { - var value: Any - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> ObjectsEvent? { - let value = pigeonVar_list[0]! - - return ObjectsEvent( - value: value - ) - } - func toList() -> [Any?] { - return [ - value - ] - } - static func == (lhs: ObjectsEvent, rhs: ObjectsEvent) -> Bool { - return deepEqualsEventChannelTests(lhs.toList(), rhs.toList()) - } - func hash(into hasher: inout Hasher) { - deepHashEventChannelTests(value: toList(), hasher: &hasher) - } -} - -/// Generated class from Pigeon that represents data sent in messages. -struct EnumEvent: PlatformEvent { - var value: EventEnum - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> EnumEvent? { - let value = pigeonVar_list[0] as! EventEnum - - return EnumEvent( - value: value - ) - } - func toList() -> [Any?] { - return [ - value - ] - } - static func == (lhs: EnumEvent, rhs: EnumEvent) -> Bool { - return deepEqualsEventChannelTests(lhs.toList(), rhs.toList()) - } - func hash(into hasher: inout Hasher) { - deepHashEventChannelTests(value: toList(), hasher: &hasher) - } -} - -/// Generated class from Pigeon that represents data sent in messages. -struct ClassEvent: PlatformEvent { - var value: EventAllNullableTypes - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> ClassEvent? { - let value = pigeonVar_list[0] as! EventAllNullableTypes - - return ClassEvent( - value: value - ) - } - func toList() -> [Any?] { - return [ - value - ] - } - static func == (lhs: ClassEvent, rhs: ClassEvent) -> Bool { - return deepEqualsEventChannelTests(lhs.toList(), rhs.toList()) - } - func hash(into hasher: inout Hasher) { - deepHashEventChannelTests(value: toList(), hasher: &hasher) - } -} - -private class EventChannelTestsPigeonCodecReader: FlutterStandardReader { - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 129: - let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) - if let enumResultAsInt = enumResultAsInt { - return EventEnum(rawValue: enumResultAsInt) - } - return nil - case 130: - let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) - if let enumResultAsInt = enumResultAsInt { - return AnotherEventEnum(rawValue: enumResultAsInt) - } - return nil - case 131: - return EventAllNullableTypes.fromList(self.readValue() as! [Any?]) - case 132: - return IntEvent.fromList(self.readValue() as! [Any?]) - case 133: - return StringEvent.fromList(self.readValue() as! [Any?]) - case 134: - return BoolEvent.fromList(self.readValue() as! [Any?]) - case 135: - return DoubleEvent.fromList(self.readValue() as! [Any?]) - case 136: - return ObjectsEvent.fromList(self.readValue() as! [Any?]) - case 137: - return EnumEvent.fromList(self.readValue() as! [Any?]) - case 138: - return ClassEvent.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) - } - } -} - -private class EventChannelTestsPigeonCodecWriter: FlutterStandardWriter { - override func writeValue(_ value: Any) { - if let value = value as? EventEnum { - super.writeByte(129) - super.writeValue(value.rawValue) - } else if let value = value as? AnotherEventEnum { - super.writeByte(130) - super.writeValue(value.rawValue) - } else if let value = value as? EventAllNullableTypes { - super.writeByte(131) - super.writeValue(value.toList()) - } else if let value = value as? IntEvent { - super.writeByte(132) - super.writeValue(value.toList()) - } else if let value = value as? StringEvent { - super.writeByte(133) - super.writeValue(value.toList()) - } else if let value = value as? BoolEvent { - super.writeByte(134) - super.writeValue(value.toList()) - } else if let value = value as? DoubleEvent { - super.writeByte(135) - super.writeValue(value.toList()) - } else if let value = value as? ObjectsEvent { - super.writeByte(136) - super.writeValue(value.toList()) - } else if let value = value as? EnumEvent { - super.writeByte(137) - super.writeValue(value.toList()) - } else if let value = value as? ClassEvent { - super.writeByte(138) - super.writeValue(value.toList()) - } else { - super.writeValue(value) - } - } -} - -private class EventChannelTestsPigeonCodecReaderWriter: FlutterStandardReaderWriter { - override func reader(with data: Data) -> FlutterStandardReader { - return EventChannelTestsPigeonCodecReader(data: data) - } - - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return EventChannelTestsPigeonCodecWriter(data: data) - } -} - -class EventChannelTestsPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = EventChannelTestsPigeonCodec( - readerWriter: EventChannelTestsPigeonCodecReaderWriter()) -} - -var eventChannelTestsPigeonMethodCodec = FlutterStandardMethodCodec( - readerWriter: EventChannelTestsPigeonCodecReaderWriter()) - -private class PigeonStreamHandler: NSObject, FlutterStreamHandler { - private let wrapper: PigeonEventChannelWrapper - private var pigeonSink: PigeonEventSink? = nil - - init(wrapper: PigeonEventChannelWrapper) { - self.wrapper = wrapper - } - - func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) - -> FlutterError? - { - pigeonSink = PigeonEventSink(events) - wrapper.onListen(withArguments: arguments, sink: pigeonSink!) - return nil - } - - func onCancel(withArguments arguments: Any?) -> FlutterError? { - pigeonSink = nil - wrapper.onCancel(withArguments: arguments) - return nil - } -} - -class PigeonEventChannelWrapper { - func onListen(withArguments arguments: Any?, sink: PigeonEventSink) {} - func onCancel(withArguments arguments: Any?) {} -} - -class PigeonEventSink { - private let sink: FlutterEventSink - - init(_ sink: @escaping FlutterEventSink) { - self.sink = sink - } - - func success(_ value: ReturnType) { - sink(value) - } - - func error(code: String, message: String?, details: Any?) { - sink(FlutterError(code: code, message: message, details: details)) - } - - func endOfStream() { - sink(FlutterEndOfEventStream) - } - -} - -class StreamIntsStreamHandler: PigeonEventChannelWrapper { - static func register( - with messenger: FlutterBinaryMessenger, - instanceName: String = "", - streamHandler: StreamIntsStreamHandler - ) { - var channelName = "dev.flutter.pigeon.pigeon_integration_tests.EventChannelMethods.streamInts" - if !instanceName.isEmpty { - channelName += ".\(instanceName)" - } - let internalStreamHandler = PigeonStreamHandler(wrapper: streamHandler) - let channel = FlutterEventChannel( - name: channelName, binaryMessenger: messenger, codec: eventChannelTestsPigeonMethodCodec) - channel.setStreamHandler(internalStreamHandler) - } -} - -class StreamEventsStreamHandler: PigeonEventChannelWrapper { - static func register( - with messenger: FlutterBinaryMessenger, - instanceName: String = "", - streamHandler: StreamEventsStreamHandler - ) { - var channelName = "dev.flutter.pigeon.pigeon_integration_tests.EventChannelMethods.streamEvents" - if !instanceName.isEmpty { - channelName += ".\(instanceName)" - } - let internalStreamHandler = PigeonStreamHandler(wrapper: streamHandler) - let channel = FlutterEventChannel( - name: channelName, binaryMessenger: messenger, codec: eventChannelTestsPigeonMethodCodec) - channel.setStreamHandler(internalStreamHandler) - } -} - -class StreamConsistentNumbersStreamHandler: PigeonEventChannelWrapper { - static func register( - with messenger: FlutterBinaryMessenger, - instanceName: String = "", - streamHandler: StreamConsistentNumbersStreamHandler - ) { - var channelName = - "dev.flutter.pigeon.pigeon_integration_tests.EventChannelMethods.streamConsistentNumbers" - if !instanceName.isEmpty { - channelName += ".\(instanceName)" - } - let internalStreamHandler = PigeonStreamHandler(wrapper: streamHandler) - let channel = FlutterEventChannel( - name: channelName, binaryMessenger: messenger, codec: eventChannelTestsPigeonMethodCodec) - channel.setStreamHandler(internalStreamHandler) - } -} diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/ProxyApiTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/ProxyApiTests.gen.swift deleted file mode 100644 index bc369d16ee2..00000000000 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/ProxyApiTests.gen.swift +++ /dev/null @@ -1,4153 +0,0 @@ -// 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 -#elseif os(macOS) - import FlutterMacOS -#else - #error("Unsupported platform.") -#endif - -/// Error class for passing custom error details to Dart side. -final class ProxyApiTestsError: Error { - let code: String - let message: String? - let details: Sendable? - - init(code: String, message: String?, details: Sendable?) { - self.code = code - self.message = message - self.details = details - } - - var localizedDescription: String { - return - "ProxyApiTestsError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" - } -} - -private func wrapResult(_ result: Any?) -> [Any?] { - return [result] -} - -private func wrapError(_ error: Any) -> [Any?] { - if let pigeonError = error as? ProxyApiTestsError { - return [ - pigeonError.code, - pigeonError.message, - pigeonError.details, - ] - } - if let flutterError = error as? FlutterError { - return [ - flutterError.code, - flutterError.message, - flutterError.details, - ] - } - return [ - "\(error)", - "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)", - ] -} - -private func createConnectionError(withChannelName channelName: String) -> ProxyApiTestsError { - return ProxyApiTestsError( - code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", - details: "") -} - -private func isNullish(_ value: Any?) -> Bool { - return value is NSNull || value == nil -} - -private func nilOrValue(_ value: Any?) -> T? { - if value is NSNull { return nil } - return value as! T? -} - -/// Handles the callback when an object is deallocated. -protocol ProxyApiTestsPigeonInternalFinalizerDelegate: AnyObject { - /// Invoked when the strong reference of an object is deallocated in an `InstanceManager`. - func onDeinit(identifier: Int64) -} - -// Attaches to an object to receive a callback when the object is deallocated. -internal final class ProxyApiTestsPigeonInternalFinalizer { - private static let associatedObjectKey = malloc(1)! - - private let identifier: Int64 - // Reference to the delegate is weak because the callback should be ignored if the - // `InstanceManager` is deallocated. - private weak var delegate: ProxyApiTestsPigeonInternalFinalizerDelegate? - - private init(identifier: Int64, delegate: ProxyApiTestsPigeonInternalFinalizerDelegate) { - self.identifier = identifier - self.delegate = delegate - } - - internal static func attach( - to instance: AnyObject, identifier: Int64, - delegate: ProxyApiTestsPigeonInternalFinalizerDelegate - ) { - let finalizer = ProxyApiTestsPigeonInternalFinalizer(identifier: identifier, delegate: delegate) - objc_setAssociatedObject(instance, associatedObjectKey, finalizer, .OBJC_ASSOCIATION_RETAIN) - } - - static func detach(from instance: AnyObject) { - objc_setAssociatedObject(instance, associatedObjectKey, nil, .OBJC_ASSOCIATION_ASSIGN) - } - - deinit { - delegate?.onDeinit(identifier: identifier) - } -} - -/// Maintains instances used to communicate with the corresponding objects in Dart. -/// -/// Objects stored in this container are represented by an object in Dart that is also stored in -/// an InstanceManager with the same identifier. -/// -/// When an instance is added with an identifier, either can be used to retrieve the other. -/// -/// Added instances are added as a weak reference and a strong reference. When the strong -/// reference is removed and the weak reference is deallocated,`ProxyApiTestsPigeonInternalFinalizerDelegate.onDeinit` -/// is called with the instance's identifier. However, if the strong reference is removed and then the identifier is -/// retrieved with the intention to pass the identifier to Dart (e.g. by calling `identifierWithStrongReference`), -/// the strong reference to the instance is re-added. The strong reference will then need to be removed manually -/// again. -/// -/// Accessing and inserting to an InstanceManager is thread safe. -final class ProxyApiTestsPigeonInstanceManager { - // Identifiers are locked to a specific range to avoid collisions with objects - // created simultaneously from Dart. - // Host uses identifiers >= 2^16 and Dart is expected to use values n where, - // 0 <= n < 2^16. - private static let minHostCreatedIdentifier: Int64 = 65536 - - private let lockQueue = DispatchQueue(label: "ProxyApiTestsPigeonInstanceManager") - private let identifiers: NSMapTable = NSMapTable( - keyOptions: [.weakMemory, .objectPointerPersonality], valueOptions: .strongMemory) - private let weakInstances: NSMapTable = NSMapTable( - keyOptions: .strongMemory, valueOptions: [.weakMemory, .objectPointerPersonality]) - private let strongInstances: NSMapTable = NSMapTable( - keyOptions: .strongMemory, valueOptions: [.strongMemory, .objectPointerPersonality]) - private let finalizerDelegate: ProxyApiTestsPigeonInternalFinalizerDelegate - private var nextIdentifier: Int64 = minHostCreatedIdentifier - - public init(finalizerDelegate: ProxyApiTestsPigeonInternalFinalizerDelegate) { - self.finalizerDelegate = finalizerDelegate - } - - /// Adds a new instance that was instantiated from Dart. - /// - /// The same instance can be added multiple times, but each identifier must be unique. This allows - /// two objects that are equivalent (e.g. conforms to `Equatable`) to both be added. - /// - /// - Parameters: - /// - instance: the instance to be stored - /// - identifier: the identifier to be paired with instance. This value must be >= 0 and unique - func addDartCreatedInstance(_ instance: AnyObject, withIdentifier identifier: Int64) { - lockQueue.async { - self.addInstance(instance, withIdentifier: identifier) - } - } - - /// Adds a new instance that was instantiated from the host platform. - /// - /// - Parameters: - /// - instance: the instance to be stored. This must be unique to all other added instances. - /// - Returns: the unique identifier (>= 0) stored with instance - func addHostCreatedInstance(_ instance: AnyObject) -> Int64 { - assert(!containsInstance(instance), "Instance of \(instance) has already been added.") - var identifier: Int64 = -1 - lockQueue.sync { - identifier = nextIdentifier - nextIdentifier += 1 - self.addInstance(instance, withIdentifier: identifier) - } - return identifier - } - - /// Removes `instanceIdentifier` and its associated strongly referenced instance, if present, from the manager. - /// - /// - Parameters: - /// - instanceIdentifier: the identifier paired to an instance. - /// - Returns: removed instance if the manager contains the given identifier, otherwise `nil` if - /// the manager doesn't contain the value - func removeInstance(withIdentifier instanceIdentifier: Int64) throws -> T? { - var instance: AnyObject? = nil - lockQueue.sync { - instance = strongInstances.object(forKey: NSNumber(value: instanceIdentifier)) - strongInstances.removeObject(forKey: NSNumber(value: instanceIdentifier)) - } - return instance as? T - } - - /// Retrieves the instance associated with identifier. - /// - /// - Parameters: - /// - instanceIdentifier: the identifier associated with an instance - /// - Returns: the instance associated with `instanceIdentifier` if the manager contains the value, otherwise - /// `nil` if the manager doesn't contain the value - func instance(forIdentifier instanceIdentifier: Int64) -> T? { - var instance: AnyObject? = nil - lockQueue.sync { - instance = weakInstances.object(forKey: NSNumber(value: instanceIdentifier)) - } - return instance as? T - } - - private func addInstance(_ instance: AnyObject, withIdentifier identifier: Int64) { - assert(identifier >= 0) - assert( - weakInstances.object(forKey: identifier as NSNumber) == nil, - "Identifier has already been added: \(identifier)") - identifiers.setObject(NSNumber(value: identifier), forKey: instance) - weakInstances.setObject(instance, forKey: NSNumber(value: identifier)) - strongInstances.setObject(instance, forKey: NSNumber(value: identifier)) - ProxyApiTestsPigeonInternalFinalizer.attach( - to: instance, identifier: identifier, delegate: finalizerDelegate) - } - - /// Retrieves the identifier paired with an instance. - /// - /// If the manager contains a strong reference to `instance`, it will return the identifier - /// associated with `instance`. If the manager contains only a weak reference to `instance`, a new - /// strong reference to `instance` will be added and will need to be removed again with `removeInstance`. - /// - /// If this method returns a nonnull identifier, this method also expects the Dart - /// `ProxyApiTestsPigeonInstanceManager` to have, or recreate, a weak reference to the Dart instance the - /// identifier is associated with. - /// - /// - Parameters: - /// - instance: an instance that may be stored in the manager - /// - Returns: the identifier associated with `instance` if the manager contains the value, otherwise - /// `nil` if the manager doesn't contain the value - func identifierWithStrongReference(forInstance instance: AnyObject) -> Int64? { - var identifier: Int64? = nil - lockQueue.sync { - if let existingIdentifier = identifiers.object(forKey: instance)?.int64Value { - strongInstances.setObject(instance, forKey: NSNumber(value: existingIdentifier)) - identifier = existingIdentifier - } - } - return identifier - } - - /// Whether this manager contains the given `instance`. - /// - /// - Parameters: - /// - instance: the instance whose presence in this manager is to be tested - /// - Returns: whether this manager contains the given `instance` - func containsInstance(_ instance: AnyObject) -> Bool { - var containsInstance = false - lockQueue.sync { - containsInstance = identifiers.object(forKey: instance) != nil - } - return containsInstance - } - - /// Removes all of the instances from this manager. - /// - /// The manager will be empty after this call returns. - func removeAllObjects() throws { - lockQueue.sync { - identifiers.removeAllObjects() - weakInstances.removeAllObjects() - strongInstances.removeAllObjects() - nextIdentifier = ProxyApiTestsPigeonInstanceManager.minHostCreatedIdentifier - } - } - - /// The number of instances stored as a strong reference. - /// - /// For debugging and testing purposes. - internal var strongInstanceCount: Int { - var count: Int = 0 - lockQueue.sync { - count = strongInstances.count - } - return count - } - - /// The number of instances stored as a weak reference. - /// - /// For debugging and testing purposes. NSMapTables that store keys or objects as weak - /// reference will be reclaimed non-deterministically. - internal var weakInstanceCount: Int { - var count: Int = 0 - lockQueue.sync { - count = weakInstances.count - } - return count - } -} - -private class ProxyApiTestsPigeonInstanceManagerApi { - /// The codec used for serializing messages. - var codec: FlutterStandardMessageCodec { ProxyApiTestsPigeonCodec.shared } - - /// Handles sending and receiving messages with Dart. - unowned let binaryMessenger: FlutterBinaryMessenger - - init(binaryMessenger: FlutterBinaryMessenger) { - self.binaryMessenger = binaryMessenger - } - - /// Sets up an instance of `ProxyApiTestsPigeonInstanceManagerApi` to handle messages through the `binaryMessenger`. - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, instanceManager: ProxyApiTestsPigeonInstanceManager? - ) { - let codec = ProxyApiTestsPigeonCodec.shared - let removeStrongReferenceChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.PigeonInternalInstanceManager.removeStrongReference", - binaryMessenger: binaryMessenger, codec: codec) - if let instanceManager = instanceManager { - removeStrongReferenceChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let identifierArg = args[0] as! Int64 - do { - let _: AnyObject? = try instanceManager.removeInstance(withIdentifier: identifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - removeStrongReferenceChannel.setMessageHandler(nil) - } - let clearChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.PigeonInternalInstanceManager.clear", - binaryMessenger: binaryMessenger, codec: codec) - if let instanceManager = instanceManager { - clearChannel.setMessageHandler { _, reply in - do { - try instanceManager.removeAllObjects() - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - clearChannel.setMessageHandler(nil) - } - } - - /// Sends a message to the Dart `InstanceManager` to remove the strong reference of the instance associated with `identifier`. - func removeStrongReference( - identifier identifierArg: Int64, - completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.PigeonInternalInstanceManager.removeStrongReference" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([identifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - completion(.success(())) - } - } - } -} -protocol ProxyApiTestsPigeonProxyApiDelegate { - /// An implementation of [PigeonApiProxyApiTestClass] used to add a new Dart instance of - /// `ProxyApiTestClass` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiProxyApiTestClass(_ registrar: ProxyApiTestsPigeonProxyApiRegistrar) - -> PigeonApiProxyApiTestClass - /// An implementation of [PigeonApiProxyApiSuperClass] used to add a new Dart instance of - /// `ProxyApiSuperClass` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiProxyApiSuperClass(_ registrar: ProxyApiTestsPigeonProxyApiRegistrar) - -> PigeonApiProxyApiSuperClass - /// An implementation of [PigeonApiProxyApiInterface] used to add a new Dart instance of - /// `ProxyApiInterface` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiProxyApiInterface(_ registrar: ProxyApiTestsPigeonProxyApiRegistrar) - -> PigeonApiProxyApiInterface - /// An implementation of [PigeonApiClassWithApiRequirement] used to add a new Dart instance of - /// `ClassWithApiRequirement` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiClassWithApiRequirement(_ registrar: ProxyApiTestsPigeonProxyApiRegistrar) - -> PigeonApiClassWithApiRequirement -} - -extension ProxyApiTestsPigeonProxyApiDelegate { - func pigeonApiProxyApiInterface(_ registrar: ProxyApiTestsPigeonProxyApiRegistrar) - -> PigeonApiProxyApiInterface - { - return PigeonApiProxyApiInterface( - pigeonRegistrar: registrar, delegate: PigeonApiDelegateProxyApiInterface()) - } -} - -open class ProxyApiTestsPigeonProxyApiRegistrar { - let binaryMessenger: FlutterBinaryMessenger - let apiDelegate: ProxyApiTestsPigeonProxyApiDelegate - let instanceManager: ProxyApiTestsPigeonInstanceManager - /// Whether APIs should ignore calling to Dart. - public var ignoreCallsToDart = false - private var _codec: FlutterStandardMessageCodec? - var codec: FlutterStandardMessageCodec { - if _codec == nil { - _codec = FlutterStandardMessageCodec( - readerWriter: ProxyApiTestsPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: self)) - } - return _codec! - } - - private class InstanceManagerApiFinalizerDelegate: ProxyApiTestsPigeonInternalFinalizerDelegate { - let api: ProxyApiTestsPigeonInstanceManagerApi - - init(_ api: ProxyApiTestsPigeonInstanceManagerApi) { - self.api = api - } - - public func onDeinit(identifier: Int64) { - api.removeStrongReference(identifier: identifier) { - _ in - } - } - } - - init(binaryMessenger: FlutterBinaryMessenger, apiDelegate: ProxyApiTestsPigeonProxyApiDelegate) { - self.binaryMessenger = binaryMessenger - self.apiDelegate = apiDelegate - self.instanceManager = ProxyApiTestsPigeonInstanceManager( - finalizerDelegate: InstanceManagerApiFinalizerDelegate( - ProxyApiTestsPigeonInstanceManagerApi(binaryMessenger: binaryMessenger))) - } - - func setUp() { - ProxyApiTestsPigeonInstanceManagerApi.setUpMessageHandlers( - binaryMessenger: binaryMessenger, instanceManager: instanceManager) - PigeonApiProxyApiTestClass.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiProxyApiTestClass(self)) - PigeonApiProxyApiSuperClass.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiProxyApiSuperClass(self)) - PigeonApiClassWithApiRequirement.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiClassWithApiRequirement(self)) - } - func tearDown() { - ProxyApiTestsPigeonInstanceManagerApi.setUpMessageHandlers( - binaryMessenger: binaryMessenger, instanceManager: nil) - PigeonApiProxyApiTestClass.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiProxyApiSuperClass.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiClassWithApiRequirement.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: nil) - } -} -private class ProxyApiTestsPigeonInternalProxyApiCodecReaderWriter: FlutterStandardReaderWriter { - unowned let pigeonRegistrar: ProxyApiTestsPigeonProxyApiRegistrar - - private class ProxyApiTestsPigeonInternalProxyApiCodecReader: ProxyApiTestsPigeonCodecReader { - unowned let pigeonRegistrar: ProxyApiTestsPigeonProxyApiRegistrar - - init(data: Data, pigeonRegistrar: ProxyApiTestsPigeonProxyApiRegistrar) { - self.pigeonRegistrar = pigeonRegistrar - super.init(data: data) - } - - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 128: - let identifier = self.readValue() - let instance: AnyObject? = pigeonRegistrar.instanceManager.instance( - forIdentifier: identifier is Int64 ? identifier as! Int64 : Int64(identifier as! Int32)) - if instance == nil { - print("Failed to find instance with identifier: \(identifier!)") - } - return instance - default: - return super.readValue(ofType: type) - } - } - } - - private class ProxyApiTestsPigeonInternalProxyApiCodecWriter: ProxyApiTestsPigeonCodecWriter { - unowned let pigeonRegistrar: ProxyApiTestsPigeonProxyApiRegistrar - - init(data: NSMutableData, pigeonRegistrar: ProxyApiTestsPigeonProxyApiRegistrar) { - self.pigeonRegistrar = pigeonRegistrar - super.init(data: data) - } - - override func writeValue(_ value: Any) { - if value is [Any] || value is Bool || value is Data || value is [AnyHashable: Any] - || value is Double || value is FlutterStandardTypedData || value is Int64 || value is String - || value is ProxyApiTestEnum - { - super.writeValue(value) - return - } - - if let instance = value as? ProxyApiTestClass { - pigeonRegistrar.apiDelegate.pigeonApiProxyApiTestClass(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) - return - } - - if let instance = value as? ProxyApiSuperClass { - pigeonRegistrar.apiDelegate.pigeonApiProxyApiSuperClass(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) - return - } - - if let instance = value as? ProxyApiInterface { - pigeonRegistrar.apiDelegate.pigeonApiProxyApiInterface(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) - return - } - - if #available(iOS 15.0.0, macOS 10.0.0, *), let instance = value as? ClassWithApiRequirement { - pigeonRegistrar.apiDelegate.pigeonApiClassWithApiRequirement(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) - return - } - - if let instance = value as AnyObject?, - pigeonRegistrar.instanceManager.containsInstance(instance) - { - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance)!) - } else { - print("Unsupported value: \(value) of \(type(of: value))") - assert(false, "Unsupported value for ProxyApiTestsPigeonInternalProxyApiCodecWriter") - } - - } - } - - init(pigeonRegistrar: ProxyApiTestsPigeonProxyApiRegistrar) { - self.pigeonRegistrar = pigeonRegistrar - } - - override func reader(with data: Data) -> FlutterStandardReader { - return ProxyApiTestsPigeonInternalProxyApiCodecReader( - data: data, pigeonRegistrar: pigeonRegistrar) - } - - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return ProxyApiTestsPigeonInternalProxyApiCodecWriter( - data: data, pigeonRegistrar: pigeonRegistrar) - } -} - -enum ProxyApiTestEnum: Int { - case one = 0 - case two = 1 - case three = 2 -} - -private class ProxyApiTestsPigeonCodecReader: FlutterStandardReader { - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 129: - let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) - if let enumResultAsInt = enumResultAsInt { - return ProxyApiTestEnum(rawValue: enumResultAsInt) - } - return nil - default: - return super.readValue(ofType: type) - } - } -} - -private class ProxyApiTestsPigeonCodecWriter: FlutterStandardWriter { - override func writeValue(_ value: Any) { - if let value = value as? ProxyApiTestEnum { - super.writeByte(129) - super.writeValue(value.rawValue) - } else { - super.writeValue(value) - } - } -} - -private class ProxyApiTestsPigeonCodecReaderWriter: FlutterStandardReaderWriter { - override func reader(with data: Data) -> FlutterStandardReader { - return ProxyApiTestsPigeonCodecReader(data: data) - } - - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return ProxyApiTestsPigeonCodecWriter(data: data) - } -} - -class ProxyApiTestsPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = ProxyApiTestsPigeonCodec(readerWriter: ProxyApiTestsPigeonCodecReaderWriter()) -} - -protocol PigeonApiDelegateProxyApiTestClass { - func pigeonDefaultConstructor( - pigeonApi: PigeonApiProxyApiTestClass, aBool: Bool, anInt: Int64, aDouble: Double, - aString: String, aUint8List: FlutterStandardTypedData, aList: [Any?], aMap: [String?: Any?], - anEnum: ProxyApiTestEnum, aProxyApi: ProxyApiSuperClass, aNullableBool: Bool?, - aNullableInt: Int64?, aNullableDouble: Double?, aNullableString: String?, - aNullableUint8List: FlutterStandardTypedData?, aNullableList: [Any?]?, - aNullableMap: [String?: Any?]?, aNullableEnum: ProxyApiTestEnum?, - aNullableProxyApi: ProxyApiSuperClass?, boolParam: Bool, intParam: Int64, doubleParam: Double, - stringParam: String, aUint8ListParam: FlutterStandardTypedData, listParam: [Any?], - mapParam: [String?: Any?], enumParam: ProxyApiTestEnum, proxyApiParam: ProxyApiSuperClass, - nullableBoolParam: Bool?, nullableIntParam: Int64?, nullableDoubleParam: Double?, - nullableStringParam: String?, nullableUint8ListParam: FlutterStandardTypedData?, - nullableListParam: [Any?]?, nullableMapParam: [String?: Any?]?, - nullableEnumParam: ProxyApiTestEnum?, nullableProxyApiParam: ProxyApiSuperClass? - ) throws -> ProxyApiTestClass - func namedConstructor( - pigeonApi: PigeonApiProxyApiTestClass, aBool: Bool, anInt: Int64, aDouble: Double, - aString: String, aUint8List: FlutterStandardTypedData, aList: [Any?], aMap: [String?: Any?], - anEnum: ProxyApiTestEnum, aProxyApi: ProxyApiSuperClass, aNullableBool: Bool?, - aNullableInt: Int64?, aNullableDouble: Double?, aNullableString: String?, - aNullableUint8List: FlutterStandardTypedData?, aNullableList: [Any?]?, - aNullableMap: [String?: Any?]?, aNullableEnum: ProxyApiTestEnum?, - aNullableProxyApi: ProxyApiSuperClass? - ) throws -> ProxyApiTestClass - func attachedField(pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass) - throws -> ProxyApiSuperClass - func staticAttachedField(pigeonApi: PigeonApiProxyApiTestClass) throws -> ProxyApiSuperClass - /// A no-op function taking no arguments and returning no value, to sanity - /// test basic calling. - func noop(pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass) throws - /// Returns an error, to test error handling. - func throwError(pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass) throws - -> Any? - /// Returns an error from a void function, to test error handling. - func throwErrorFromVoid(pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass) - throws - /// Returns a Flutter error, to test error handling. - func throwFlutterError(pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass) - throws -> Any? - /// Returns passed in int. - func echoInt( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, anInt: Int64 - ) throws -> Int64 - /// Returns passed in double. - func echoDouble( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aDouble: Double - ) throws -> Double - /// Returns the passed in boolean. - func echoBool( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aBool: Bool - ) throws -> Bool - /// Returns the passed in string. - func echoString( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aString: String - ) throws -> String - /// Returns the passed in Uint8List. - func echoUint8List( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aUint8List: FlutterStandardTypedData - ) throws -> FlutterStandardTypedData - /// Returns the passed in generic Object. - func echoObject( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, anObject: Any - ) throws -> Any - /// Returns the passed list, to test serialization and deserialization. - func echoList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aList: [Any?] - ) throws -> [Any?] - /// Returns the passed list with ProxyApis, to test serialization and - /// deserialization. - func echoProxyApiList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aList: [ProxyApiTestClass] - ) throws -> [ProxyApiTestClass] - /// Returns the passed map, to test serialization and deserialization. - func echoMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aMap: [String?: Any?] - ) throws -> [String?: Any?] - /// Returns the passed map with ProxyApis, to test serialization and - /// deserialization. - func echoProxyApiMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aMap: [String: ProxyApiTestClass] - ) throws -> [String: ProxyApiTestClass] - /// Returns the passed enum to test serialization and deserialization. - func echoEnum( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - anEnum: ProxyApiTestEnum - ) throws -> ProxyApiTestEnum - /// Returns the passed ProxyApi to test serialization and deserialization. - func echoProxyApi( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aProxyApi: ProxyApiSuperClass - ) throws -> ProxyApiSuperClass - /// Returns passed in int. - func echoNullableInt( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aNullableInt: Int64? - ) throws -> Int64? - /// Returns passed in double. - func echoNullableDouble( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableDouble: Double? - ) throws -> Double? - /// Returns the passed in boolean. - func echoNullableBool( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aNullableBool: Bool? - ) throws -> Bool? - /// Returns the passed in string. - func echoNullableString( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableString: String? - ) throws -> String? - /// Returns the passed in Uint8List. - func echoNullableUint8List( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableUint8List: FlutterStandardTypedData? - ) throws -> FlutterStandardTypedData? - /// Returns the passed in generic Object. - func echoNullableObject( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aNullableObject: Any? - ) throws -> Any? - /// Returns the passed list, to test serialization and deserialization. - func echoNullableList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aNullableList: [Any?]? - ) throws -> [Any?]? - /// Returns the passed map, to test serialization and deserialization. - func echoNullableMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableMap: [String?: Any?]? - ) throws -> [String?: Any?]? - func echoNullableEnum( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableEnum: ProxyApiTestEnum? - ) throws -> ProxyApiTestEnum? - /// Returns the passed ProxyApi to test serialization and deserialization. - func echoNullableProxyApi( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aNullableProxyApi: ProxyApiSuperClass? - ) throws -> ProxyApiSuperClass? - /// A no-op function taking no arguments and returning no value, to sanity - /// test basic asynchronous calling. - func noopAsync( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void) - /// Returns passed in int asynchronously. - func echoAsyncInt( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, anInt: Int64, - completion: @escaping (Result) -> Void) - /// Returns passed in double asynchronously. - func echoAsyncDouble( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aDouble: Double, - completion: @escaping (Result) -> Void) - /// Returns the passed in boolean asynchronously. - func echoAsyncBool( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aBool: Bool, - completion: @escaping (Result) -> Void) - /// Returns the passed string asynchronously. - func echoAsyncString( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aString: String, - completion: @escaping (Result) -> Void) - /// Returns the passed in Uint8List asynchronously. - func echoAsyncUint8List( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aUint8List: FlutterStandardTypedData, - completion: @escaping (Result) -> Void) - /// Returns the passed in generic Object asynchronously. - func echoAsyncObject( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, anObject: Any, - completion: @escaping (Result) -> Void) - /// Returns the passed list, to test asynchronous serialization and deserialization. - func echoAsyncList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aList: [Any?], - completion: @escaping (Result<[Any?], Error>) -> Void) - /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsyncMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aMap: [String?: Any?], - completion: @escaping (Result<[String?: Any?], Error>) -> Void) - /// Returns the passed enum, to test asynchronous serialization and deserialization. - func echoAsyncEnum( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - anEnum: ProxyApiTestEnum, completion: @escaping (Result) -> Void) - /// Responds with an error from an async function returning a value. - func throwAsyncError( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void) - /// Responds with an error from an async void function. - func throwAsyncErrorFromVoid( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void) - /// Responds with a Flutter error from an async function returning a value. - func throwAsyncFlutterError( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void) - /// Returns passed in int asynchronously. - func echoAsyncNullableInt( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, anInt: Int64?, - completion: @escaping (Result) -> Void) - /// Returns passed in double asynchronously. - func echoAsyncNullableDouble( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aDouble: Double?, - completion: @escaping (Result) -> Void) - /// Returns the passed in boolean asynchronously. - func echoAsyncNullableBool( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aBool: Bool?, - completion: @escaping (Result) -> Void) - /// Returns the passed string asynchronously. - func echoAsyncNullableString( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aString: String?, - completion: @escaping (Result) -> Void) - /// Returns the passed in Uint8List asynchronously. - func echoAsyncNullableUint8List( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aUint8List: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void) - /// Returns the passed in generic Object asynchronously. - func echoAsyncNullableObject( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, anObject: Any?, - completion: @escaping (Result) -> Void) - /// Returns the passed list, to test asynchronous serialization and deserialization. - func echoAsyncNullableList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aList: [Any?]?, - completion: @escaping (Result<[Any?]?, Error>) -> Void) - /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsyncNullableMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) - /// Returns the passed enum, to test asynchronous serialization and deserialization. - func echoAsyncNullableEnum( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - anEnum: ProxyApiTestEnum?, completion: @escaping (Result) -> Void) - func staticNoop(pigeonApi: PigeonApiProxyApiTestClass) throws - func echoStaticString(pigeonApi: PigeonApiProxyApiTestClass, aString: String) throws -> String - func staticAsyncNoop( - pigeonApi: PigeonApiProxyApiTestClass, completion: @escaping (Result) -> Void) - func callFlutterNoop( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void) - func callFlutterThrowError( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void) - func callFlutterThrowErrorFromVoid( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void) - func callFlutterEchoBool( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aBool: Bool, - completion: @escaping (Result) -> Void) - func callFlutterEchoInt( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, anInt: Int64, - completion: @escaping (Result) -> Void) - func callFlutterEchoDouble( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aDouble: Double, - completion: @escaping (Result) -> Void) - func callFlutterEchoString( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aString: String, - completion: @escaping (Result) -> Void) - func callFlutterEchoUint8List( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aUint8List: FlutterStandardTypedData, - completion: @escaping (Result) -> Void) - func callFlutterEchoList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aList: [Any?], - completion: @escaping (Result<[Any?], Error>) -> Void) - func callFlutterEchoProxyApiList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aList: [ProxyApiTestClass?], completion: @escaping (Result<[ProxyApiTestClass?], Error>) -> Void - ) - func callFlutterEchoMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aMap: [String?: Any?], - completion: @escaping (Result<[String?: Any?], Error>) -> Void) - func callFlutterEchoProxyApiMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aMap: [String?: ProxyApiTestClass?], - completion: @escaping (Result<[String?: ProxyApiTestClass?], Error>) -> Void) - func callFlutterEchoEnum( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - anEnum: ProxyApiTestEnum, completion: @escaping (Result) -> Void) - func callFlutterEchoProxyApi( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aProxyApi: ProxyApiSuperClass, completion: @escaping (Result) -> Void - ) - func callFlutterEchoNullableBool( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aBool: Bool?, - completion: @escaping (Result) -> Void) - func callFlutterEchoNullableInt( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, anInt: Int64?, - completion: @escaping (Result) -> Void) - func callFlutterEchoNullableDouble( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aDouble: Double?, - completion: @escaping (Result) -> Void) - func callFlutterEchoNullableString( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aString: String?, - completion: @escaping (Result) -> Void) - func callFlutterEchoNullableUint8List( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aUint8List: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void) - func callFlutterEchoNullableList( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aList: [Any?]?, - completion: @escaping (Result<[Any?]?, Error>) -> Void) - func callFlutterEchoNullableMap( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) - func callFlutterEchoNullableEnum( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - anEnum: ProxyApiTestEnum?, completion: @escaping (Result) -> Void) - func callFlutterEchoNullableProxyApi( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - aProxyApi: ProxyApiSuperClass?, - completion: @escaping (Result) -> Void) - func callFlutterNoopAsync( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void) - func callFlutterEchoAsyncString( - pigeonApi: PigeonApiProxyApiTestClass, pigeonInstance: ProxyApiTestClass, aString: String, - completion: @escaping (Result) -> Void) -} - -protocol PigeonApiProtocolProxyApiTestClass { - /// A no-op function taking no arguments and returning no value, to sanity - /// test basic calling. - func flutterNoop( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, - completion: @escaping (Result) -> Void) - /// Responds with an error from an async function returning a value. - func flutterThrowError( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, - completion: @escaping (Result) -> Void) - /// Responds with an error from an async void function. - func flutterThrowErrorFromVoid( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, - completion: @escaping (Result) -> Void) - /// Returns the passed boolean, to test serialization and deserialization. - func flutterEchoBool( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aBool aBoolArg: Bool, - completion: @escaping (Result) -> Void) - /// Returns the passed int, to test serialization and deserialization. - func flutterEchoInt( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, anInt anIntArg: Int64, - completion: @escaping (Result) -> Void) - /// Returns the passed double, to test serialization and deserialization. - func flutterEchoDouble( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aDouble aDoubleArg: Double, - completion: @escaping (Result) -> Void) - /// Returns the passed string, to test serialization and deserialization. - func flutterEchoString( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aString aStringArg: String, - completion: @escaping (Result) -> Void) - /// Returns the passed byte list, to test serialization and deserialization. - func flutterEchoUint8List( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aList aListArg: FlutterStandardTypedData, - completion: @escaping (Result) -> Void) - /// Returns the passed list, to test serialization and deserialization. - func flutterEchoList( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aList aListArg: [Any?], - completion: @escaping (Result<[Any?], ProxyApiTestsError>) -> Void) - /// Returns the passed list with ProxyApis, to test serialization and - /// deserialization. - func flutterEchoProxyApiList( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aList aListArg: [ProxyApiTestClass?], - completion: @escaping (Result<[ProxyApiTestClass?], ProxyApiTestsError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func flutterEchoMap( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aMap aMapArg: [String?: Any?], - completion: @escaping (Result<[String?: Any?], ProxyApiTestsError>) -> Void) - /// Returns the passed map with ProxyApis, to test serialization and - /// deserialization. - func flutterEchoProxyApiMap( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, - aMap aMapArg: [String?: ProxyApiTestClass?], - completion: @escaping (Result<[String?: ProxyApiTestClass?], ProxyApiTestsError>) -> Void) - /// Returns the passed enum to test serialization and deserialization. - func flutterEchoEnum( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, anEnum anEnumArg: ProxyApiTestEnum, - completion: @escaping (Result) -> Void) - /// Returns the passed ProxyApi to test serialization and deserialization. - func flutterEchoProxyApi( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aProxyApi aProxyApiArg: ProxyApiSuperClass, - completion: @escaping (Result) -> Void) - /// Returns the passed boolean, to test serialization and deserialization. - func flutterEchoNullableBool( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aBool aBoolArg: Bool?, - completion: @escaping (Result) -> Void) - /// Returns the passed int, to test serialization and deserialization. - func flutterEchoNullableInt( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, anInt anIntArg: Int64?, - completion: @escaping (Result) -> Void) - /// Returns the passed double, to test serialization and deserialization. - func flutterEchoNullableDouble( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aDouble aDoubleArg: Double?, - completion: @escaping (Result) -> Void) - /// Returns the passed string, to test serialization and deserialization. - func flutterEchoNullableString( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aString aStringArg: String?, - completion: @escaping (Result) -> Void) - /// Returns the passed byte list, to test serialization and deserialization. - func flutterEchoNullableUint8List( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aList aListArg: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void) - /// Returns the passed list, to test serialization and deserialization. - func flutterEchoNullableList( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aList aListArg: [Any?]?, - completion: @escaping (Result<[Any?]?, ProxyApiTestsError>) -> Void) - /// Returns the passed map, to test serialization and deserialization. - func flutterEchoNullableMap( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aMap aMapArg: [String?: Any?]?, - completion: @escaping (Result<[String?: Any?]?, ProxyApiTestsError>) -> Void) - /// Returns the passed enum to test serialization and deserialization. - func flutterEchoNullableEnum( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, anEnum anEnumArg: ProxyApiTestEnum?, - completion: @escaping (Result) -> Void) - /// Returns the passed ProxyApi to test serialization and deserialization. - func flutterEchoNullableProxyApi( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, - aProxyApi aProxyApiArg: ProxyApiSuperClass?, - completion: @escaping (Result) -> Void) - /// A no-op function taking no arguments and returning no value, to sanity - /// test basic asynchronous calling. - func flutterNoopAsync( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, - completion: @escaping (Result) -> Void) - /// Returns the passed in generic Object asynchronously. - func flutterEchoAsyncString( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aString aStringArg: String, - completion: @escaping (Result) -> Void) -} - -final class PigeonApiProxyApiTestClass: PigeonApiProtocolProxyApiTestClass { - unowned let pigeonRegistrar: ProxyApiTestsPigeonProxyApiRegistrar - let pigeonDelegate: PigeonApiDelegateProxyApiTestClass - ///An implementation of [ProxyApiSuperClass] used to access callback methods - var pigeonApiProxyApiSuperClass: PigeonApiProxyApiSuperClass { - return pigeonRegistrar.apiDelegate.pigeonApiProxyApiSuperClass(pigeonRegistrar) - } - - ///An implementation of [ProxyApiInterface] used to access callback methods - var pigeonApiProxyApiInterface: PigeonApiProxyApiInterface { - return pigeonRegistrar.apiDelegate.pigeonApiProxyApiInterface(pigeonRegistrar) - } - - init( - pigeonRegistrar: ProxyApiTestsPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateProxyApiTestClass - ) { - self.pigeonRegistrar = pigeonRegistrar - self.pigeonDelegate = delegate - } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiProxyApiTestClass? - ) { - let codec: FlutterStandardMessageCodec = - api != nil - ? FlutterStandardMessageCodec( - readerWriter: ProxyApiTestsPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) - : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - let aBoolArg = args[1] as! Bool - let anIntArg = args[2] as! Int64 - let aDoubleArg = args[3] as! Double - let aStringArg = args[4] as! String - let aUint8ListArg = args[5] as! FlutterStandardTypedData - let aListArg = args[6] as! [Any?] - let aMapArg = args[7] as! [String?: Any?] - let anEnumArg = args[8] as! ProxyApiTestEnum - let aProxyApiArg = args[9] as! ProxyApiSuperClass - let aNullableBoolArg: Bool? = nilOrValue(args[10]) - let aNullableIntArg: Int64? = nilOrValue(args[11]) - let aNullableDoubleArg: Double? = nilOrValue(args[12]) - let aNullableStringArg: String? = nilOrValue(args[13]) - let aNullableUint8ListArg: FlutterStandardTypedData? = nilOrValue(args[14]) - let aNullableListArg: [Any?]? = nilOrValue(args[15]) - let aNullableMapArg: [String?: Any?]? = nilOrValue(args[16]) - let aNullableEnumArg: ProxyApiTestEnum? = nilOrValue(args[17]) - let aNullableProxyApiArg: ProxyApiSuperClass? = nilOrValue(args[18]) - let boolParamArg = args[19] as! Bool - let intParamArg = args[20] as! Int64 - let doubleParamArg = args[21] as! Double - let stringParamArg = args[22] as! String - let aUint8ListParamArg = args[23] as! FlutterStandardTypedData - let listParamArg = args[24] as! [Any?] - let mapParamArg = args[25] as! [String?: Any?] - let enumParamArg = args[26] as! ProxyApiTestEnum - let proxyApiParamArg = args[27] as! ProxyApiSuperClass - let nullableBoolParamArg: Bool? = nilOrValue(args[28]) - let nullableIntParamArg: Int64? = nilOrValue(args[29]) - let nullableDoubleParamArg: Double? = nilOrValue(args[30]) - let nullableStringParamArg: String? = nilOrValue(args[31]) - let nullableUint8ListParamArg: FlutterStandardTypedData? = nilOrValue(args[32]) - let nullableListParamArg: [Any?]? = nilOrValue(args[33]) - let nullableMapParamArg: [String?: Any?]? = nilOrValue(args[34]) - let nullableEnumParamArg: ProxyApiTestEnum? = nilOrValue(args[35]) - let nullableProxyApiParamArg: ProxyApiSuperClass? = nilOrValue(args[36]) - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor( - pigeonApi: api, aBool: aBoolArg, anInt: anIntArg, aDouble: aDoubleArg, - aString: aStringArg, aUint8List: aUint8ListArg, aList: aListArg, aMap: aMapArg, - anEnum: anEnumArg, aProxyApi: aProxyApiArg, aNullableBool: aNullableBoolArg, - aNullableInt: aNullableIntArg, aNullableDouble: aNullableDoubleArg, - aNullableString: aNullableStringArg, aNullableUint8List: aNullableUint8ListArg, - aNullableList: aNullableListArg, aNullableMap: aNullableMapArg, - aNullableEnum: aNullableEnumArg, aNullableProxyApi: aNullableProxyApiArg, - boolParam: boolParamArg, intParam: intParamArg, doubleParam: doubleParamArg, - stringParam: stringParamArg, aUint8ListParam: aUint8ListParamArg, - listParam: listParamArg, mapParam: mapParamArg, enumParam: enumParamArg, - proxyApiParam: proxyApiParamArg, nullableBoolParam: nullableBoolParamArg, - nullableIntParam: nullableIntParamArg, nullableDoubleParam: nullableDoubleParamArg, - nullableStringParam: nullableStringParamArg, - nullableUint8ListParam: nullableUint8ListParamArg, - nullableListParam: nullableListParamArg, nullableMapParam: nullableMapParamArg, - nullableEnumParam: nullableEnumParamArg, - nullableProxyApiParam: nullableProxyApiParamArg), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) - } - let namedConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.namedConstructor", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - namedConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - let aBoolArg = args[1] as! Bool - let anIntArg = args[2] as! Int64 - let aDoubleArg = args[3] as! Double - let aStringArg = args[4] as! String - let aUint8ListArg = args[5] as! FlutterStandardTypedData - let aListArg = args[6] as! [Any?] - let aMapArg = args[7] as! [String?: Any?] - let anEnumArg = args[8] as! ProxyApiTestEnum - let aProxyApiArg = args[9] as! ProxyApiSuperClass - let aNullableBoolArg: Bool? = nilOrValue(args[10]) - let aNullableIntArg: Int64? = nilOrValue(args[11]) - let aNullableDoubleArg: Double? = nilOrValue(args[12]) - let aNullableStringArg: String? = nilOrValue(args[13]) - let aNullableUint8ListArg: FlutterStandardTypedData? = nilOrValue(args[14]) - let aNullableListArg: [Any?]? = nilOrValue(args[15]) - let aNullableMapArg: [String?: Any?]? = nilOrValue(args[16]) - let aNullableEnumArg: ProxyApiTestEnum? = nilOrValue(args[17]) - let aNullableProxyApiArg: ProxyApiSuperClass? = nilOrValue(args[18]) - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.namedConstructor( - pigeonApi: api, aBool: aBoolArg, anInt: anIntArg, aDouble: aDoubleArg, - aString: aStringArg, aUint8List: aUint8ListArg, aList: aListArg, aMap: aMapArg, - anEnum: anEnumArg, aProxyApi: aProxyApiArg, aNullableBool: aNullableBoolArg, - aNullableInt: aNullableIntArg, aNullableDouble: aNullableDoubleArg, - aNullableString: aNullableStringArg, aNullableUint8List: aNullableUint8ListArg, - aNullableList: aNullableListArg, aNullableMap: aNullableMapArg, - aNullableEnum: aNullableEnumArg, aNullableProxyApi: aNullableProxyApiArg), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - namedConstructorChannel.setMessageHandler(nil) - } - let attachedFieldChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.attachedField", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - attachedFieldChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let pigeonIdentifierArg = args[1] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.attachedField(pigeonApi: api, pigeonInstance: pigeonInstanceArg), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - attachedFieldChannel.setMessageHandler(nil) - } - let staticAttachedFieldChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.staticAttachedField", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - staticAttachedFieldChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.staticAttachedField(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - staticAttachedFieldChannel.setMessageHandler(nil) - } - let noopChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.noop", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - noopChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - do { - try api.pigeonDelegate.noop(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - noopChannel.setMessageHandler(nil) - } - let throwErrorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwError", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - throwErrorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - do { - let result = try api.pigeonDelegate.throwError( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - throwErrorChannel.setMessageHandler(nil) - } - let throwErrorFromVoidChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwErrorFromVoid", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - throwErrorFromVoidChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - do { - try api.pigeonDelegate.throwErrorFromVoid( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - throwErrorFromVoidChannel.setMessageHandler(nil) - } - let throwFlutterErrorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwFlutterError", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - throwFlutterErrorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - do { - let result = try api.pigeonDelegate.throwFlutterError( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - throwFlutterErrorChannel.setMessageHandler(nil) - } - let echoIntChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoInt", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoIntChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let anIntArg = args[1] as! Int64 - do { - let result = try api.pigeonDelegate.echoInt( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, anInt: anIntArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoIntChannel.setMessageHandler(nil) - } - let echoDoubleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoDouble", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoDoubleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aDoubleArg = args[1] as! Double - do { - let result = try api.pigeonDelegate.echoDouble( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aDouble: aDoubleArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoDoubleChannel.setMessageHandler(nil) - } - let echoBoolChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoBool", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoBoolChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aBoolArg = args[1] as! Bool - do { - let result = try api.pigeonDelegate.echoBool( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aBool: aBoolArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoBoolChannel.setMessageHandler(nil) - } - let echoStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoString", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aStringArg = args[1] as! String - do { - let result = try api.pigeonDelegate.echoString( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aString: aStringArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoStringChannel.setMessageHandler(nil) - } - let echoUint8ListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoUint8List", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoUint8ListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aUint8ListArg = args[1] as! FlutterStandardTypedData - do { - let result = try api.pigeonDelegate.echoUint8List( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aUint8List: aUint8ListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoUint8ListChannel.setMessageHandler(nil) - } - let echoObjectChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoObject", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoObjectChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let anObjectArg = args[1]! - do { - let result = try api.pigeonDelegate.echoObject( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, anObject: anObjectArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoObjectChannel.setMessageHandler(nil) - } - let echoListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoList", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aListArg = args[1] as! [Any?] - do { - let result = try api.pigeonDelegate.echoList( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aList: aListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoListChannel.setMessageHandler(nil) - } - let echoProxyApiListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoProxyApiList", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoProxyApiListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aListArg = args[1] as! [ProxyApiTestClass] - do { - let result = try api.pigeonDelegate.echoProxyApiList( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aList: aListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoProxyApiListChannel.setMessageHandler(nil) - } - let echoMapChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoMap", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aMapArg = args[1] as! [String?: Any?] - do { - let result = try api.pigeonDelegate.echoMap( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aMap: aMapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoMapChannel.setMessageHandler(nil) - } - let echoProxyApiMapChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoProxyApiMap", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoProxyApiMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aMapArg = args[1] as! [String: ProxyApiTestClass] - do { - let result = try api.pigeonDelegate.echoProxyApiMap( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aMap: aMapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoProxyApiMapChannel.setMessageHandler(nil) - } - let echoEnumChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoEnum", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let anEnumArg = args[1] as! ProxyApiTestEnum - do { - let result = try api.pigeonDelegate.echoEnum( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, anEnum: anEnumArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoEnumChannel.setMessageHandler(nil) - } - let echoProxyApiChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoProxyApi", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoProxyApiChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aProxyApiArg = args[1] as! ProxyApiSuperClass - do { - let result = try api.pigeonDelegate.echoProxyApi( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aProxyApi: aProxyApiArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoProxyApiChannel.setMessageHandler(nil) - } - let echoNullableIntChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableInt", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableIntChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aNullableIntArg: Int64? = nilOrValue(args[1]) - do { - let result = try api.pigeonDelegate.echoNullableInt( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aNullableInt: aNullableIntArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableIntChannel.setMessageHandler(nil) - } - let echoNullableDoubleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableDouble", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableDoubleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aNullableDoubleArg: Double? = nilOrValue(args[1]) - do { - let result = try api.pigeonDelegate.echoNullableDouble( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aNullableDouble: aNullableDoubleArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableDoubleChannel.setMessageHandler(nil) - } - let echoNullableBoolChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableBool", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableBoolChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aNullableBoolArg: Bool? = nilOrValue(args[1]) - do { - let result = try api.pigeonDelegate.echoNullableBool( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aNullableBool: aNullableBoolArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableBoolChannel.setMessageHandler(nil) - } - let echoNullableStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableString", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aNullableStringArg: String? = nilOrValue(args[1]) - do { - let result = try api.pigeonDelegate.echoNullableString( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aNullableString: aNullableStringArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableStringChannel.setMessageHandler(nil) - } - let echoNullableUint8ListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableUint8List", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableUint8ListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aNullableUint8ListArg: FlutterStandardTypedData? = nilOrValue(args[1]) - do { - let result = try api.pigeonDelegate.echoNullableUint8List( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, - aNullableUint8List: aNullableUint8ListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableUint8ListChannel.setMessageHandler(nil) - } - let echoNullableObjectChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableObject", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableObjectChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aNullableObjectArg: Any? = args[1] - do { - let result = try api.pigeonDelegate.echoNullableObject( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aNullableObject: aNullableObjectArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableObjectChannel.setMessageHandler(nil) - } - let echoNullableListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableList", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aNullableListArg: [Any?]? = nilOrValue(args[1]) - do { - let result = try api.pigeonDelegate.echoNullableList( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aNullableList: aNullableListArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableListChannel.setMessageHandler(nil) - } - let echoNullableMapChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableMap", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aNullableMapArg: [String?: Any?]? = nilOrValue(args[1]) - do { - let result = try api.pigeonDelegate.echoNullableMap( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aNullableMap: aNullableMapArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableMapChannel.setMessageHandler(nil) - } - let echoNullableEnumChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableEnum", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aNullableEnumArg: ProxyApiTestEnum? = nilOrValue(args[1]) - do { - let result = try api.pigeonDelegate.echoNullableEnum( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aNullableEnum: aNullableEnumArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableEnumChannel.setMessageHandler(nil) - } - let echoNullableProxyApiChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoNullableProxyApi", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoNullableProxyApiChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aNullableProxyApiArg: ProxyApiSuperClass? = nilOrValue(args[1]) - do { - let result = try api.pigeonDelegate.echoNullableProxyApi( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, - aNullableProxyApi: aNullableProxyApiArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoNullableProxyApiChannel.setMessageHandler(nil) - } - let noopAsyncChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.noopAsync", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - noopAsyncChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - api.pigeonDelegate.noopAsync(pigeonApi: api, pigeonInstance: pigeonInstanceArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - noopAsyncChannel.setMessageHandler(nil) - } - let echoAsyncIntChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncInt", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncIntChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let anIntArg = args[1] as! Int64 - api.pigeonDelegate.echoAsyncInt( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, anInt: anIntArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncIntChannel.setMessageHandler(nil) - } - let echoAsyncDoubleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncDouble", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncDoubleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aDoubleArg = args[1] as! Double - api.pigeonDelegate.echoAsyncDouble( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aDouble: aDoubleArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncDoubleChannel.setMessageHandler(nil) - } - let echoAsyncBoolChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncBool", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncBoolChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aBoolArg = args[1] as! Bool - api.pigeonDelegate.echoAsyncBool( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aBool: aBoolArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncBoolChannel.setMessageHandler(nil) - } - let echoAsyncStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncString", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aStringArg = args[1] as! String - api.pigeonDelegate.echoAsyncString( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aString: aStringArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncStringChannel.setMessageHandler(nil) - } - let echoAsyncUint8ListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncUint8List", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncUint8ListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aUint8ListArg = args[1] as! FlutterStandardTypedData - api.pigeonDelegate.echoAsyncUint8List( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aUint8List: aUint8ListArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncUint8ListChannel.setMessageHandler(nil) - } - let echoAsyncObjectChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncObject", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncObjectChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let anObjectArg = args[1]! - api.pigeonDelegate.echoAsyncObject( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, anObject: anObjectArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncObjectChannel.setMessageHandler(nil) - } - let echoAsyncListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncList", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aListArg = args[1] as! [Any?] - api.pigeonDelegate.echoAsyncList( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aList: aListArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncListChannel.setMessageHandler(nil) - } - let echoAsyncMapChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncMap", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aMapArg = args[1] as! [String?: Any?] - api.pigeonDelegate.echoAsyncMap( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aMap: aMapArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncMapChannel.setMessageHandler(nil) - } - let echoAsyncEnumChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncEnum", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let anEnumArg = args[1] as! ProxyApiTestEnum - api.pigeonDelegate.echoAsyncEnum( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, anEnum: anEnumArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncEnumChannel.setMessageHandler(nil) - } - let throwAsyncErrorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwAsyncError", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - throwAsyncErrorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - api.pigeonDelegate.throwAsyncError(pigeonApi: api, pigeonInstance: pigeonInstanceArg) { - result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - throwAsyncErrorChannel.setMessageHandler(nil) - } - let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwAsyncErrorFromVoid", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - throwAsyncErrorFromVoidChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - api.pigeonDelegate.throwAsyncErrorFromVoid( - pigeonApi: api, pigeonInstance: pigeonInstanceArg - ) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - throwAsyncErrorFromVoidChannel.setMessageHandler(nil) - } - let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.throwAsyncFlutterError", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - throwAsyncFlutterErrorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - api.pigeonDelegate.throwAsyncFlutterError(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - throwAsyncFlutterErrorChannel.setMessageHandler(nil) - } - let echoAsyncNullableIntChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableInt", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableIntChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let anIntArg: Int64? = nilOrValue(args[1]) - api.pigeonDelegate.echoAsyncNullableInt( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, anInt: anIntArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableIntChannel.setMessageHandler(nil) - } - let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableDouble", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableDoubleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aDoubleArg: Double? = nilOrValue(args[1]) - api.pigeonDelegate.echoAsyncNullableDouble( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aDouble: aDoubleArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableDoubleChannel.setMessageHandler(nil) - } - let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableBool", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableBoolChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aBoolArg: Bool? = nilOrValue(args[1]) - api.pigeonDelegate.echoAsyncNullableBool( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aBool: aBoolArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableBoolChannel.setMessageHandler(nil) - } - let echoAsyncNullableStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableString", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aStringArg: String? = nilOrValue(args[1]) - api.pigeonDelegate.echoAsyncNullableString( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aString: aStringArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableStringChannel.setMessageHandler(nil) - } - let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableUint8List", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableUint8ListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aUint8ListArg: FlutterStandardTypedData? = nilOrValue(args[1]) - api.pigeonDelegate.echoAsyncNullableUint8List( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aUint8List: aUint8ListArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableUint8ListChannel.setMessageHandler(nil) - } - let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableObject", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableObjectChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let anObjectArg: Any? = args[1] - api.pigeonDelegate.echoAsyncNullableObject( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, anObject: anObjectArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableObjectChannel.setMessageHandler(nil) - } - let echoAsyncNullableListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableList", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aListArg: [Any?]? = nilOrValue(args[1]) - api.pigeonDelegate.echoAsyncNullableList( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aList: aListArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableListChannel.setMessageHandler(nil) - } - let echoAsyncNullableMapChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableMap", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aMapArg: [String?: Any?]? = nilOrValue(args[1]) - api.pigeonDelegate.echoAsyncNullableMap( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aMap: aMapArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableMapChannel.setMessageHandler(nil) - } - let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoAsyncNullableEnum", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoAsyncNullableEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let anEnumArg: ProxyApiTestEnum? = nilOrValue(args[1]) - api.pigeonDelegate.echoAsyncNullableEnum( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, anEnum: anEnumArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - echoAsyncNullableEnumChannel.setMessageHandler(nil) - } - let staticNoopChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.staticNoop", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - staticNoopChannel.setMessageHandler { _, reply in - do { - try api.pigeonDelegate.staticNoop(pigeonApi: api) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - staticNoopChannel.setMessageHandler(nil) - } - let echoStaticStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.echoStaticString", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - echoStaticStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let aStringArg = args[0] as! String - do { - let result = try api.pigeonDelegate.echoStaticString(pigeonApi: api, aString: aStringArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - echoStaticStringChannel.setMessageHandler(nil) - } - let staticAsyncNoopChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.staticAsyncNoop", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - staticAsyncNoopChannel.setMessageHandler { _, reply in - api.pigeonDelegate.staticAsyncNoop(pigeonApi: api) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - staticAsyncNoopChannel.setMessageHandler(nil) - } - let callFlutterNoopChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterNoop", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterNoopChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - api.pigeonDelegate.callFlutterNoop(pigeonApi: api, pigeonInstance: pigeonInstanceArg) { - result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterNoopChannel.setMessageHandler(nil) - } - let callFlutterThrowErrorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterThrowError", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterThrowErrorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - api.pigeonDelegate.callFlutterThrowError(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterThrowErrorChannel.setMessageHandler(nil) - } - let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterThrowErrorFromVoid", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterThrowErrorFromVoidChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - api.pigeonDelegate.callFlutterThrowErrorFromVoid( - pigeonApi: api, pigeonInstance: pigeonInstanceArg - ) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterThrowErrorFromVoidChannel.setMessageHandler(nil) - } - let callFlutterEchoBoolChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoBool", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoBoolChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aBoolArg = args[1] as! Bool - api.pigeonDelegate.callFlutterEchoBool( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aBool: aBoolArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoBoolChannel.setMessageHandler(nil) - } - let callFlutterEchoIntChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoInt", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoIntChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let anIntArg = args[1] as! Int64 - api.pigeonDelegate.callFlutterEchoInt( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, anInt: anIntArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoIntChannel.setMessageHandler(nil) - } - let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoDouble", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoDoubleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aDoubleArg = args[1] as! Double - api.pigeonDelegate.callFlutterEchoDouble( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aDouble: aDoubleArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoDoubleChannel.setMessageHandler(nil) - } - let callFlutterEchoStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoString", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aStringArg = args[1] as! String - api.pigeonDelegate.callFlutterEchoString( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aString: aStringArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoStringChannel.setMessageHandler(nil) - } - let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoUint8List", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aUint8ListArg = args[1] as! FlutterStandardTypedData - api.pigeonDelegate.callFlutterEchoUint8List( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aUint8List: aUint8ListArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoUint8ListChannel.setMessageHandler(nil) - } - let callFlutterEchoListChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoList", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aListArg = args[1] as! [Any?] - api.pigeonDelegate.callFlutterEchoList( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aList: aListArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoListChannel.setMessageHandler(nil) - } - let callFlutterEchoProxyApiListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoProxyApiList", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoProxyApiListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aListArg = args[1] as! [ProxyApiTestClass?] - api.pigeonDelegate.callFlutterEchoProxyApiList( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aList: aListArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoProxyApiListChannel.setMessageHandler(nil) - } - let callFlutterEchoMapChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoMap", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aMapArg = args[1] as! [String?: Any?] - api.pigeonDelegate.callFlutterEchoMap( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aMap: aMapArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoMapChannel.setMessageHandler(nil) - } - let callFlutterEchoProxyApiMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoProxyApiMap", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoProxyApiMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aMapArg = args[1] as! [String?: ProxyApiTestClass?] - api.pigeonDelegate.callFlutterEchoProxyApiMap( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aMap: aMapArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoProxyApiMapChannel.setMessageHandler(nil) - } - let callFlutterEchoEnumChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoEnum", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let anEnumArg = args[1] as! ProxyApiTestEnum - api.pigeonDelegate.callFlutterEchoEnum( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, anEnum: anEnumArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoEnumChannel.setMessageHandler(nil) - } - let callFlutterEchoProxyApiChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoProxyApi", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoProxyApiChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aProxyApiArg = args[1] as! ProxyApiSuperClass - api.pigeonDelegate.callFlutterEchoProxyApi( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aProxyApi: aProxyApiArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoProxyApiChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableBool", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aBoolArg: Bool? = nilOrValue(args[1]) - api.pigeonDelegate.callFlutterEchoNullableBool( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aBool: aBoolArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableBoolChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableInt", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let anIntArg: Int64? = nilOrValue(args[1]) - api.pigeonDelegate.callFlutterEchoNullableInt( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, anInt: anIntArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableIntChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableDouble", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aDoubleArg: Double? = nilOrValue(args[1]) - api.pigeonDelegate.callFlutterEchoNullableDouble( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aDouble: aDoubleArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableDoubleChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableString", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aStringArg: String? = nilOrValue(args[1]) - api.pigeonDelegate.callFlutterEchoNullableString( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aString: aStringArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableStringChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableUint8List", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aUint8ListArg: FlutterStandardTypedData? = nilOrValue(args[1]) - api.pigeonDelegate.callFlutterEchoNullableUint8List( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aUint8List: aUint8ListArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableUint8ListChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableList", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableListChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aListArg: [Any?]? = nilOrValue(args[1]) - api.pigeonDelegate.callFlutterEchoNullableList( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aList: aListArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableListChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableMap", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aMapArg: [String?: Any?]? = nilOrValue(args[1]) - api.pigeonDelegate.callFlutterEchoNullableMap( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aMap: aMapArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableMapChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableEnum", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableEnumChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let anEnumArg: ProxyApiTestEnum? = nilOrValue(args[1]) - api.pigeonDelegate.callFlutterEchoNullableEnum( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, anEnum: anEnumArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableEnumChannel.setMessageHandler(nil) - } - let callFlutterEchoNullableProxyApiChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoNullableProxyApi", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoNullableProxyApiChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aProxyApiArg: ProxyApiSuperClass? = nilOrValue(args[1]) - api.pigeonDelegate.callFlutterEchoNullableProxyApi( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aProxyApi: aProxyApiArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoNullableProxyApiChannel.setMessageHandler(nil) - } - let callFlutterNoopAsyncChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterNoopAsync", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterNoopAsyncChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - api.pigeonDelegate.callFlutterNoopAsync(pigeonApi: api, pigeonInstance: pigeonInstanceArg) { - result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterNoopAsyncChannel.setMessageHandler(nil) - } - let callFlutterEchoAsyncStringChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.callFlutterEchoAsyncString", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - callFlutterEchoAsyncStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiTestClass - let aStringArg = args[1] as! String - api.pigeonDelegate.callFlutterEchoAsyncString( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, aString: aStringArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - callFlutterEchoAsyncStringChannel.setMessageHandler(nil) - } - } - - ///Creates a Dart instance of ProxyApiTestClass and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: ProxyApiTestClass, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(())) - } else { - completion( - .failure( - ProxyApiTestsError( - code: "new-instance-error", - message: - "Error: Attempting to create a new Dart instance of ProxyApiTestClass, but the class has a nonnull callback method.", - details: ""))) - } - } - /// A no-op function taking no arguments and returning no value, to sanity - /// test basic calling. - func flutterNoop( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterNoop" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - completion(.success(())) - } - } - } - - /// Responds with an error from an async function returning a value. - func flutterThrowError( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterThrowError" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - let result: Any? = listResponse[0] - completion(.success(result)) - } - } - } - - /// Responds with an error from an async void function. - func flutterThrowErrorFromVoid( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterThrowErrorFromVoid" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - completion(.success(())) - } - } - } - - /// Returns the passed boolean, to test serialization and deserialization. - func flutterEchoBool( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aBool aBoolArg: Bool, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoBool" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aBoolArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - ProxyApiTestsError( - 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)) - } - } - } - - /// Returns the passed int, to test serialization and deserialization. - func flutterEchoInt( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, anInt anIntArg: Int64, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoInt" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, anIntArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - ProxyApiTestsError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! Int64 - completion(.success(result)) - } - } - } - - /// Returns the passed double, to test serialization and deserialization. - func flutterEchoDouble( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aDouble aDoubleArg: Double, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoDouble" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aDoubleArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - ProxyApiTestsError( - 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)) - } - } - } - - /// Returns the passed string, to test serialization and deserialization. - func flutterEchoString( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aString aStringArg: String, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoString" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aStringArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - ProxyApiTestsError( - 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)) - } - } - } - - /// Returns the passed byte list, to test serialization and deserialization. - func flutterEchoUint8List( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aList aListArg: FlutterStandardTypedData, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoUint8List" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aListArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - ProxyApiTestsError( - 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)) - } - } - } - - /// Returns the passed list, to test serialization and deserialization. - func flutterEchoList( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aList aListArg: [Any?], - completion: @escaping (Result<[Any?], ProxyApiTestsError>) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoList" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aListArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - ProxyApiTestsError( - 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)) - } - } - } - - /// Returns the passed list with ProxyApis, to test serialization and - /// deserialization. - func flutterEchoProxyApiList( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aList aListArg: [ProxyApiTestClass?], - completion: @escaping (Result<[ProxyApiTestClass?], ProxyApiTestsError>) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApiList" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aListArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - ProxyApiTestsError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! [ProxyApiTestClass?] - completion(.success(result)) - } - } - } - - /// Returns the passed map, to test serialization and deserialization. - func flutterEchoMap( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aMap aMapArg: [String?: Any?], - completion: @escaping (Result<[String?: Any?], ProxyApiTestsError>) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoMap" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - ProxyApiTestsError( - 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)) - } - } - } - - /// Returns the passed map with ProxyApis, to test serialization and - /// deserialization. - func flutterEchoProxyApiMap( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, - aMap aMapArg: [String?: ProxyApiTestClass?], - completion: @escaping (Result<[String?: ProxyApiTestClass?], ProxyApiTestsError>) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApiMap" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - ProxyApiTestsError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! [String?: ProxyApiTestClass?] - completion(.success(result)) - } - } - } - - /// Returns the passed enum to test serialization and deserialization. - func flutterEchoEnum( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, anEnum anEnumArg: ProxyApiTestEnum, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoEnum" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, anEnumArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - ProxyApiTestsError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! ProxyApiTestEnum - completion(.success(result)) - } - } - } - - /// Returns the passed ProxyApi to test serialization and deserialization. - func flutterEchoProxyApi( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aProxyApi aProxyApiArg: ProxyApiSuperClass, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoProxyApi" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aProxyApiArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - ProxyApiTestsError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! ProxyApiSuperClass - completion(.success(result)) - } - } - } - - /// Returns the passed boolean, to test serialization and deserialization. - func flutterEchoNullableBool( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aBool aBoolArg: Bool?, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableBool" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aBoolArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - let result: Bool? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - - /// Returns the passed int, to test serialization and deserialization. - func flutterEchoNullableInt( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, anInt anIntArg: Int64?, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableInt" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, anIntArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - let result: Int64? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - - /// Returns the passed double, to test serialization and deserialization. - func flutterEchoNullableDouble( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aDouble aDoubleArg: Double?, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableDouble" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aDoubleArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - let result: Double? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - - /// Returns the passed string, to test serialization and deserialization. - func flutterEchoNullableString( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aString aStringArg: String?, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableString" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aStringArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - let result: String? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - - /// Returns the passed byte list, to test serialization and deserialization. - func flutterEchoNullableUint8List( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aList aListArg: FlutterStandardTypedData?, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableUint8List" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aListArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - let result: FlutterStandardTypedData? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - - /// Returns the passed list, to test serialization and deserialization. - func flutterEchoNullableList( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aList aListArg: [Any?]?, - completion: @escaping (Result<[Any?]?, ProxyApiTestsError>) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableList" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aListArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - let result: [Any?]? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - - /// Returns the passed map, to test serialization and deserialization. - func flutterEchoNullableMap( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aMap aMapArg: [String?: Any?]?, - completion: @escaping (Result<[String?: Any?]?, ProxyApiTestsError>) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableMap" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aMapArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - let result: [String?: Any?]? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - - /// Returns the passed enum to test serialization and deserialization. - func flutterEchoNullableEnum( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, anEnum anEnumArg: ProxyApiTestEnum?, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableEnum" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, anEnumArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - let result: ProxyApiTestEnum? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - - /// Returns the passed ProxyApi to test serialization and deserialization. - func flutterEchoNullableProxyApi( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, - aProxyApi aProxyApiArg: ProxyApiSuperClass?, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoNullableProxyApi" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aProxyApiArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - let result: ProxyApiSuperClass? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } - } - - /// A no-op function taking no arguments and returning no value, to sanity - /// test basic asynchronous calling. - func flutterNoopAsync( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterNoopAsync" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - completion(.success(())) - } - } - } - - /// Returns the passed in generic Object asynchronously. - func flutterEchoAsyncString( - pigeonInstance pigeonInstanceArg: ProxyApiTestClass, aString aStringArg: String, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiTestClass.flutterEchoAsyncString" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, aStringArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion( - .failure( - ProxyApiTestsError( - 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)) - } - } - } - -} -protocol PigeonApiDelegateProxyApiSuperClass { - func pigeonDefaultConstructor(pigeonApi: PigeonApiProxyApiSuperClass) throws -> ProxyApiSuperClass - func aSuperMethod(pigeonApi: PigeonApiProxyApiSuperClass, pigeonInstance: ProxyApiSuperClass) - throws -} - -protocol PigeonApiProtocolProxyApiSuperClass { -} - -final class PigeonApiProxyApiSuperClass: PigeonApiProtocolProxyApiSuperClass { - unowned let pigeonRegistrar: ProxyApiTestsPigeonProxyApiRegistrar - let pigeonDelegate: PigeonApiDelegateProxyApiSuperClass - init( - pigeonRegistrar: ProxyApiTestsPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateProxyApiSuperClass - ) { - self.pigeonRegistrar = pigeonRegistrar - self.pigeonDelegate = delegate - } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiProxyApiSuperClass? - ) { - let codec: FlutterStandardMessageCodec = - api != nil - ? FlutterStandardMessageCodec( - readerWriter: ProxyApiTestsPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) - : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiSuperClass.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) - } - let aSuperMethodChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiSuperClass.aSuperMethod", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - aSuperMethodChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ProxyApiSuperClass - do { - try api.pigeonDelegate.aSuperMethod(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - aSuperMethodChannel.setMessageHandler(nil) - } - } - - ///Creates a Dart instance of ProxyApiSuperClass and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: ProxyApiSuperClass, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiSuperClass.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - completion(.success(())) - } - } - } - } -} -open class PigeonApiDelegateProxyApiInterface { -} - -protocol PigeonApiProtocolProxyApiInterface { - func anInterfaceMethod( - pigeonInstance pigeonInstanceArg: ProxyApiInterface, - completion: @escaping (Result) -> Void) -} - -final class PigeonApiProxyApiInterface: PigeonApiProtocolProxyApiInterface { - unowned let pigeonRegistrar: ProxyApiTestsPigeonProxyApiRegistrar - let pigeonDelegate: PigeonApiDelegateProxyApiInterface - init( - pigeonRegistrar: ProxyApiTestsPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateProxyApiInterface - ) { - self.pigeonRegistrar = pigeonRegistrar - self.pigeonDelegate = delegate - } - ///Creates a Dart instance of ProxyApiInterface and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: ProxyApiInterface, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiInterface.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - completion(.success(())) - } - } - } - } - func anInterfaceMethod( - pigeonInstance pigeonInstanceArg: ProxyApiInterface, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ProxyApiInterface.anInterfaceMethod" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - completion(.success(())) - } - } - } - -} -protocol PigeonApiDelegateClassWithApiRequirement { - @available(iOS 15.0.0, macOS 10.0.0, *) - func pigeonDefaultConstructor(pigeonApi: PigeonApiClassWithApiRequirement) throws - -> ClassWithApiRequirement - @available(iOS 15.0.0, macOS 10.0.0, *) - func aMethod(pigeonApi: PigeonApiClassWithApiRequirement, pigeonInstance: ClassWithApiRequirement) - throws -} - -protocol PigeonApiProtocolClassWithApiRequirement { -} - -final class PigeonApiClassWithApiRequirement: PigeonApiProtocolClassWithApiRequirement { - unowned let pigeonRegistrar: ProxyApiTestsPigeonProxyApiRegistrar - let pigeonDelegate: PigeonApiDelegateClassWithApiRequirement - init( - pigeonRegistrar: ProxyApiTestsPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateClassWithApiRequirement - ) { - self.pigeonRegistrar = pigeonRegistrar - self.pigeonDelegate = delegate - } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiClassWithApiRequirement? - ) { - let codec: FlutterStandardMessageCodec = - api != nil - ? FlutterStandardMessageCodec( - readerWriter: ProxyApiTestsPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) - : FlutterStandardMessageCodec.sharedInstance() - if #available(iOS 15.0.0, macOS 10.0.0, *) { - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ClassWithApiRequirement.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) - } - } else { - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.pigeon_integration_tests.ClassWithApiRequirement.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) - if api != nil { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - reply( - wrapError( - FlutterError( - code: "PigeonUnsupportedOperationError", - message: - "Call to pigeonDefaultConstructor requires @available(iOS 15.0.0, macOS 10.0.0, *).", - details: nil - ))) - } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) - } - } - if #available(iOS 15.0.0, macOS 10.0.0, *) { - let aMethodChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ClassWithApiRequirement.aMethod", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - aMethodChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! ClassWithApiRequirement - do { - try api.pigeonDelegate.aMethod(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - aMethodChannel.setMessageHandler(nil) - } - } else { - let aMethodChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.pigeon_integration_tests.ClassWithApiRequirement.aMethod", - binaryMessenger: binaryMessenger, codec: codec) - if api != nil { - aMethodChannel.setMessageHandler { message, reply in - reply( - wrapError( - FlutterError( - code: "PigeonUnsupportedOperationError", - message: "Call to aMethod requires @available(iOS 15.0.0, macOS 10.0.0, *).", - details: nil - ))) - } - } else { - aMethodChannel.setMessageHandler(nil) - } - } - } - - ///Creates a Dart instance of ClassWithApiRequirement and attaches it to [pigeonInstance]. - @available(iOS 15.0.0, macOS 10.0.0, *) - func pigeonNewInstance( - pigeonInstance: ClassWithApiRequirement, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - ProxyApiTestsError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.pigeon_integration_tests.ClassWithApiRequirement.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - 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(ProxyApiTestsError(code: code, message: message, details: details))) - } else { - completion(.success(())) - } - } - } - } -} diff --git a/packages/pigeon/platform_tests/test_plugin/macos/test_plugin.podspec b/packages/pigeon/platform_tests/test_plugin/macos/test_plugin.podspec deleted file mode 100644 index 77a7e3bbfbd..00000000000 --- a/packages/pigeon/platform_tests/test_plugin/macos/test_plugin.podspec +++ /dev/null @@ -1,23 +0,0 @@ -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. -# Run `pod lib lint test_plugin.podspec` to validate before publishing. -# -Pod::Spec.new do |s| - s.name = 'test_plugin' - s.version = '0.0.1' - s.summary = 'Pigeon test plugin' - s.description = <<-DESC - A plugin to test Pigeon generation for primary languages. - DESC - s.homepage = 'http://example.com' - s.license = { :type => 'BSD', :file => '../../../LICENSE' } - s.author = { 'Your Company' => 'email@example.com' } - - s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/pigeon' } - s.source_files = 'Classes/**/*' - s.dependency 'FlutterMacOS' - - s.platform = :osx, '10.14' - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } - s.swift_version = '5.0' -end diff --git a/packages/pigeon/platform_tests/test_plugin/pubspec.yaml b/packages/pigeon/platform_tests/test_plugin/pubspec.yaml index 0547092ec50..f50e5da3cd1 100644 --- a/packages/pigeon/platform_tests/test_plugin/pubspec.yaml +++ b/packages/pigeon/platform_tests/test_plugin/pubspec.yaml @@ -15,10 +15,12 @@ flutter: pluginClass: TestPlugin ios: pluginClass: TestPlugin + sharedDarwinSource: true linux: pluginClass: TestPlugin macos: pluginClass: TestPlugin + sharedDarwinSource: true windows: pluginClass: TestPluginCApi diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index f1642d77176..fd03c48cee4 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: 25.3.0 # This must match the version in lib/src/generator_tools.dart +version: 25.3.1 # This must match the version in lib/src/generator_tools.dart environment: sdk: ^3.4.0 diff --git a/packages/pigeon/test/kotlin/proxy_api_test.dart b/packages/pigeon/test/kotlin/proxy_api_test.dart index fc88034531d..561acd364a0 100644 --- a/packages/pigeon/test/kotlin/proxy_api_test.dart +++ b/packages/pigeon/test/kotlin/proxy_api_test.dart @@ -999,6 +999,59 @@ void main() { ); }); }); + + group('InstanceManager', () { + test( + 'InstanceManager passes runnable field and not a new runnable instance', + () { + final Root root = Root( + apis: [ + AstProxyApi( + name: 'Api', + constructors: [], + fields: [], + methods: [], + ), + ], + classes: [], + enums: [], + ); + final StringBuffer sink = StringBuffer(); + const KotlinGenerator generator = KotlinGenerator(); + generator.generate( + const InternalKotlinOptions(kotlinOut: ''), + root, + sink, + dartPackageName: DEFAULT_PACKAGE_NAME, + ); + final String code = sink.toString(); + final String collapsedCode = _collapseNewlineAndIndentation(code); + + expect( + code, + contains( + 'handler.removeCallbacks(releaseAllFinalizedInstancesRunnable)', + ), + ); + expect( + code, + contains( + 'handler.postDelayed(releaseAllFinalizedInstancesRunnable', + ), + ); + + expect( + collapsedCode, + contains( + 'private val releaseAllFinalizedInstancesRunnable = Runnable { this.releaseAllFinalizedInstances() }', + ), + ); + expect( + 'this.releaseAllFinalizedInstances()'.allMatches(code).length, + 1, + ); + }); + }); }); } diff --git a/packages/pigeon/test/kotlin_generator_test.dart b/packages/pigeon/test/kotlin_generator_test.dart index a22d0bec484..2a72e608804 100644 --- a/packages/pigeon/test/kotlin_generator_test.dart +++ b/packages/pigeon/test/kotlin_generator_test.dart @@ -249,7 +249,7 @@ void main() { val wrapped: List = try { listOf(api.doSomething(inputArg)) } catch (exception: Throwable) { - wrapError(exception) + PigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -804,7 +804,7 @@ void main() { final String code = sink.toString(); expect(code, contains('interface Api')); expect(code, contains('api.doSomething(argArg) {')); - expect(code, contains('reply.reply(wrapResult(data))')); + expect(code, contains('reply.reply(PigeonUtils.wrapResult(data))')); }); test('gen one async Flutter Api', () { @@ -1631,7 +1631,7 @@ void main() { expect( code, contains( - 'callback(Result.failure(createConnectionError(channelName)))')); + 'callback(Result.failure(PigeonUtils.createConnectionError(channelName)))')); }); test('gen host uses default error class', () { diff --git a/packages/pigeon/tool/run_tests.dart b/packages/pigeon/tool/run_tests.dart index 28229972834..7c6c12c428a 100644 --- a/packages/pigeon/tool/run_tests.dart +++ b/packages/pigeon/tool/run_tests.dart @@ -184,6 +184,7 @@ Future main(List args) async { androidJavaUnitTests, androidJavaLint, androidKotlinUnitTests, + androidKotlinLint, androidJavaIntegrationTests, androidKotlinIntegrationTests, linuxUnitTests, diff --git a/packages/pigeon/tool/shared/generation.dart b/packages/pigeon/tool/shared/generation.dart index ec52d0b25c9..1714ffe22b4 100644 --- a/packages/pigeon/tool/shared/generation.dart +++ b/packages/pigeon/tool/shared/generation.dart @@ -101,9 +101,11 @@ Future generateTestPigeons( 'proxy_api_tests', }; - final String outputBase = p.join(baseDir, 'platform_tests', 'test_plugin'); + const String testPluginName = 'test_plugin'; + const String alternateTestPluginName = 'alternate_language_test_plugin'; + final String outputBase = p.join(baseDir, 'platform_tests', testPluginName); final String alternateOutputBase = - p.join(baseDir, 'platform_tests', 'alternate_language_test_plugin'); + p.join(baseDir, 'platform_tests', alternateTestPluginName); final String sharedDartOutputBase = p.join(baseDir, 'platform_tests', 'shared_test_plugin_code'); @@ -141,10 +143,10 @@ Future generateTestPigeons( kotlinPackage: 'com.example.test_plugin', kotlinErrorClassName: kotlinErrorName, kotlinIncludeErrorClass: input != 'primitive', - // iOS + // iOS/macOS swiftOut: skipLanguages.contains(GeneratorLanguage.swift) ? null - : '$outputBase/ios/Classes/$pascalCaseName.gen.swift', + : '$outputBase/darwin/$testPluginName/Sources/$testPluginName/$pascalCaseName.gen.swift', swiftErrorClassName: swiftErrorClassName, swiftIncludeErrorClass: input != 'primitive', // Linux @@ -169,25 +171,11 @@ Future generateTestPigeons( return generateCode; } - // macOS has to be run as a separate generation, since currently Pigeon - // doesn't have a way to output separate macOS and iOS Swift output in a - // single invocation. - generateCode = await runPigeon( - input: './pigeons/$input.dart', - swiftOut: skipLanguages.contains(GeneratorLanguage.swift) - ? null - : '$outputBase/macos/Classes/$pascalCaseName.gen.swift', - swiftErrorClassName: swiftErrorClassName, - swiftIncludeErrorClass: input != 'primitive', - suppressVersion: true, - dartPackageName: 'pigeon_integration_tests', - injectOverflowTypes: includeOverflow && input == 'core_tests', - ); - if (generateCode != 0) { - return generateCode; - } - // Generate the alternate language test plugin output. + final String objcBase = + '$alternateOutputBase/darwin/$alternateTestPluginName/Sources/$alternateTestPluginName/'; + final String objcBaseRelativeHeaderPath = + 'include/$alternateTestPluginName/$pascalCaseName.gen.h'; generateCode = await runPigeon( input: './pigeons/$input.dart', // Android @@ -198,38 +186,14 @@ Future generateTestPigeons( : '$alternateOutputBase/android/src/main/java/com/example/' 'alternate_language_test_plugin/${_javaFilenameForName(input)}.java', javaPackage: 'com.example.alternate_language_test_plugin', - // iOS + // iOS/macOS objcHeaderOut: skipLanguages.contains(GeneratorLanguage.objc) ? null - : '$alternateOutputBase/ios/Classes/$pascalCaseName.gen.h', + : '$objcBase/$objcBaseRelativeHeaderPath', objcSourceOut: skipLanguages.contains(GeneratorLanguage.objc) ? null - : '$alternateOutputBase/ios/Classes/$pascalCaseName.gen.m', - objcPrefix: input == 'core_tests' - ? 'FLT' - : input == 'enum' - ? 'PGN' - : '', - suppressVersion: true, - dartPackageName: 'pigeon_integration_tests', - injectOverflowTypes: includeOverflow && input == 'core_tests', - mergeDefinitionFileOptions: input != 'enum', - ); - if (generateCode != 0) { - return generateCode; - } - - // macOS has to be run as a separate generation, since currently Pigeon - // doesn't have a way to output separate macOS and iOS Swift output in a - // single invocation. - generateCode = await runPigeon( - input: './pigeons/$input.dart', - objcHeaderOut: skipLanguages.contains(GeneratorLanguage.objc) - ? null - : '$alternateOutputBase/macos/Classes/$pascalCaseName.gen.h', - objcSourceOut: skipLanguages.contains(GeneratorLanguage.objc) - ? null - : '$alternateOutputBase/macos/Classes/$pascalCaseName.gen.m', + : '$objcBase/$pascalCaseName.gen.m', + objcHeaderIncludePath: './$objcBaseRelativeHeaderPath', objcPrefix: input == 'core_tests' ? 'FLT' : input == 'enum' @@ -269,6 +233,7 @@ Future runPigeon({ String? objcHeaderOut, String? objcSourceOut, String objcPrefix = '', + String? objcHeaderIncludePath, bool suppressVersion = false, String copyrightHeader = './copyright_header.txt', String? basePath, @@ -328,7 +293,10 @@ Future runPigeon({ ), objcHeaderOut: objcHeaderOut, objcSourceOut: objcSourceOut, - objcOptions: ObjcOptions(prefix: objcPrefix), + objcOptions: ObjcOptions( + prefix: objcPrefix, + headerIncludePath: objcHeaderIncludePath, + ), swiftOut: swiftOut, swiftOptions: SwiftOptions( errorClassName: swiftErrorClassName, diff --git a/packages/pigeon/tool/shared/test_suites.dart b/packages/pigeon/tool/shared/test_suites.dart index fb70cbea0eb..a16afe0c2e7 100644 --- a/packages/pigeon/tool/shared/test_suites.dart +++ b/packages/pigeon/tool/shared/test_suites.dart @@ -16,9 +16,12 @@ import 'process_utils.dart'; const int _noDeviceAvailableExitCode = 100; -const String _testPluginRelativePath = 'platform_tests/test_plugin'; +const String _testPluginName = 'test_plugin'; +const String _alternateLanguageTestPluginName = + 'alternate_language_test_plugin'; +const String _testPluginRelativePath = 'platform_tests/$_testPluginName'; const String _alternateLanguageTestPluginRelativePath = - 'platform_tests/alternate_language_test_plugin'; + 'platform_tests/$_alternateLanguageTestPluginName'; const String _integrationTestFileRelativePath = 'integration_test/test.dart'; /// Information about a test suite. @@ -38,6 +41,7 @@ const String androidJavaUnitTests = 'android_java_unittests'; const String androidJavaLint = 'android_java_lint'; const String androidJavaIntegrationTests = 'android_java_integration_tests'; const String androidKotlinUnitTests = 'android_kotlin_unittests'; +const String androidKotlinLint = 'android_kotlin_lint'; const String androidKotlinIntegrationTests = 'android_kotlin_integration_tests'; const String iOSObjCUnitTests = 'ios_objc_unittests'; const String iOSObjCIntegrationTests = 'ios_objc_integration_tests'; @@ -72,6 +76,9 @@ const Map testSuites = { androidKotlinUnitTests: TestInfo( function: _runAndroidKotlinUnitTests, description: 'Unit tests on generated Kotlin code.'), + androidKotlinLint: TestInfo( + function: _runAndroidKotlinLint, + description: 'Lint generated Kotlin code.'), androidKotlinIntegrationTests: TestInfo( function: _runAndroidKotlinIntegrationTests, description: 'Integration tests on generated Kotlin code.'), @@ -123,26 +130,23 @@ Future _runAndroidJavaIntegrationTests({bool ciMode = false}) async { } Future _runAndroidJavaLint({bool ciMode = false}) async { - const String examplePath = - './$_alternateLanguageTestPluginRelativePath/example'; - const String androidProjectPath = '$examplePath/android'; - final File gradleFile = File(p.join(androidProjectPath, 'gradlew')); - if (!gradleFile.existsSync()) { - final int compileCode = await runFlutterBuild(examplePath, 'apk', - flags: ['--config-only']); - if (compileCode != 0) { - return compileCode; - } - } - - return runGradleBuild( - androidProjectPath, 'alternate_language_test_plugin:lintDebug'); + return _runAndroidLint( + testPluginName: _alternateLanguageTestPluginName, + testPluginPath: _alternateLanguageTestPluginRelativePath, + ); } Future _runAndroidKotlinUnitTests({bool ciMode = false}) async { return _runAndroidUnitTests(_testPluginRelativePath); } +Future _runAndroidKotlinLint({bool ciMode = false}) async { + return _runAndroidLint( + testPluginName: _testPluginName, + testPluginPath: _testPluginRelativePath, + ); +} + Future _runAndroidUnitTests(String testPluginPath) async { final String examplePath = './$testPluginPath/example'; final String androidProjectPath = '$examplePath/android'; @@ -157,6 +161,24 @@ Future _runAndroidUnitTests(String testPluginPath) async { return runGradleBuild(androidProjectPath, 'testDebugUnitTest'); } +Future _runAndroidLint({ + required String testPluginName, + required String testPluginPath, +}) async { + final String examplePath = './$testPluginPath/example'; + final String androidProjectPath = '$examplePath/android'; + final File gradleFile = File(p.join(androidProjectPath, 'gradlew')); + if (!gradleFile.existsSync()) { + final int compileCode = await runFlutterBuild(examplePath, 'apk', + flags: ['--config-only']); + if (compileCode != 0) { + return compileCode; + } + } + + return runGradleBuild(androidProjectPath, '$testPluginName:lintDebug'); +} + Future _runAndroidKotlinIntegrationTests({bool ciMode = false}) async { return _runMobileIntegrationTests('Android', _testPluginRelativePath); } diff --git a/packages/pigeon/tool/test.dart b/packages/pigeon/tool/test.dart index 07c7dfdf61b..dd1b331c43d 100644 --- a/packages/pigeon/tool/test.dart +++ b/packages/pigeon/tool/test.dart @@ -78,6 +78,7 @@ ${parser.usage}'''); androidJavaIntegrationTests, androidKotlinIntegrationTests, androidJavaLint, + androidKotlinLint, ]; const List iOSTests = [ iOSObjCUnitTests, diff --git a/packages/quick_actions/quick_actions/CHANGELOG.md b/packages/quick_actions/quick_actions/CHANGELOG.md index c30222dd4da..d944a9efbce 100644 --- a/packages/quick_actions/quick_actions/CHANGELOG.md +++ b/packages/quick_actions/quick_actions/CHANGELOG.md @@ -1,5 +1,6 @@ ## NEXT +* Updates README to indicate that Andoid SDK <21 is no longer supported. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 1.1.0 diff --git a/packages/quick_actions/quick_actions/README.md b/packages/quick_actions/quick_actions/README.md index 563349daab0..d9e0297cc6d 100644 --- a/packages/quick_actions/quick_actions/README.md +++ b/packages/quick_actions/quick_actions/README.md @@ -11,7 +11,7 @@ Android. | | Android | iOS | |-------------|-----------|------| -| **Support** | SDK 16+\* | 9.0+ | +| **Support** | SDK 21+\* | 9.0+ | ## Usage diff --git a/packages/quick_actions/quick_actions_android/CHANGELOG.md b/packages/quick_actions/quick_actions_android/CHANGELOG.md index 3c5f8bbc9b3..9296a5cafe0 100644 --- a/packages/quick_actions/quick_actions_android/CHANGELOG.md +++ b/packages/quick_actions/quick_actions_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.21 + +* Removes obsolete code related to supporting SDK <21. + ## 1.0.20 * Updates compileSdk 34 to flutter.compileSdkVersion. diff --git a/packages/quick_actions/quick_actions_android/android/build.gradle b/packages/quick_actions/quick_actions_android/android/build.gradle index d4a44672587..1d69f4d18fe 100644 --- a/packages/quick_actions/quick_actions_android/android/build.gradle +++ b/packages/quick_actions/quick_actions_android/android/build.gradle @@ -26,7 +26,7 @@ android { compileSdk = flutter.compileSdkVersion defaultConfig { - minSdkVersion 19 + minSdkVersion 21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { diff --git a/packages/quick_actions/quick_actions_android/example/android/build.gradle b/packages/quick_actions/quick_actions_android/example/android/build.gradle index 62ed70de53f..44c90020bf6 100644 --- a/packages/quick_actions/quick_actions_android/example/android/build.gradle +++ b/packages/quick_actions/quick_actions_android/example/android/build.gradle @@ -30,7 +30,8 @@ tasks.register("clean", Delete) { gradle.projectsEvaluated { project(":quick_actions_android") { tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" + // Ignore classfile due to https://issuetracker.google.com/issues/342067844 + options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" } } } diff --git a/packages/quick_actions/quick_actions_android/pubspec.yaml b/packages/quick_actions/quick_actions_android/pubspec.yaml index 797498e4489..1eddfda0350 100644 --- a/packages/quick_actions/quick_actions_android/pubspec.yaml +++ b/packages/quick_actions/quick_actions_android/pubspec.yaml @@ -2,7 +2,7 @@ name: quick_actions_android description: An implementation for the Android platform of the Flutter `quick_actions` plugin. repository: https://github.com/flutter/packages/tree/main/packages/quick_actions/quick_actions_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 1.0.20 +version: 1.0.21 environment: sdk: ^3.6.0 diff --git a/packages/shared_preferences/shared_preferences/CHANGELOG.md b/packages/shared_preferences/shared_preferences/CHANGELOG.md index 3449842a263..2d482355eec 100644 --- a/packages/shared_preferences/shared_preferences/CHANGELOG.md +++ b/packages/shared_preferences/shared_preferences/CHANGELOG.md @@ -1,4 +1,9 @@ +## NEXT + +* Updates README to indicate that Andoid SDK <21 is no longer supported. + ## 2.5.3 + * Fixes a bug in the example app. ## 2.5.2 diff --git a/packages/shared_preferences/shared_preferences/README.md b/packages/shared_preferences/shared_preferences/README.md index a1f8a0723bf..9cb94f65812 100644 --- a/packages/shared_preferences/shared_preferences/README.md +++ b/packages/shared_preferences/shared_preferences/README.md @@ -13,7 +13,7 @@ Supported data types are `int`, `double`, `bool`, `String` and `List`. | | Android | iOS | Linux | macOS | Web | Windows | |-------------|---------|-------|-------|--------|-----|-------------| -| **Support** | SDK 16+ | 12.0+ | Any | 10.14+ | Any | Any | +| **Support** | SDK 21+ | 12.0+ | Any | 10.14+ | Any | Any | ## Usage diff --git a/packages/shared_preferences/shared_preferences_android/CHANGELOG.md b/packages/shared_preferences/shared_preferences_android/CHANGELOG.md index f801ee97896..8f4bade3515 100644 --- a/packages/shared_preferences/shared_preferences_android/CHANGELOG.md +++ b/packages/shared_preferences/shared_preferences_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.4.10 + +* Removes obsolete code related to supporting SDK <21. + ## 2.4.9 * Enables callers to use `getInt` to read preference of type `int` that was written to shared preferences by native code without passing though plugin code. diff --git a/packages/shared_preferences/shared_preferences_android/android/build.gradle b/packages/shared_preferences/shared_preferences_android/android/build.gradle index 90da1bb5d77..0c3156fda71 100644 --- a/packages/shared_preferences/shared_preferences_android/android/build.gradle +++ b/packages/shared_preferences/shared_preferences_android/android/build.gradle @@ -50,7 +50,7 @@ android { } defaultConfig { - minSdkVersion 19 + minSdkVersion 21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { diff --git a/packages/shared_preferences/shared_preferences_android/example/android/app/build.gradle b/packages/shared_preferences/shared_preferences_android/example/android/app/build.gradle index 15bfd60a335..882dcce14a6 100644 --- a/packages/shared_preferences/shared_preferences_android/example/android/app/build.gradle +++ b/packages/shared_preferences/shared_preferences_android/example/android/app/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:8.5.1' + classpath 'com.android.tools.build:gradle:8.9.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/packages/shared_preferences/shared_preferences_android/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/shared_preferences/shared_preferences_android/example/android/gradle/wrapper/gradle-wrapper.properties index 3c85cfe057a..efdcc4ace98 100644 --- a/packages/shared_preferences/shared_preferences_android/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/shared_preferences/shared_preferences_android/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip diff --git a/packages/shared_preferences/shared_preferences_android/example/android/settings.gradle b/packages/shared_preferences/shared_preferences_android/example/android/settings.gradle index 74d52ff12f4..72725980152 100644 --- a/packages/shared_preferences/shared_preferences_android/example/android/settings.gradle +++ b/packages/shared_preferences/shared_preferences_android/example/android/settings.gradle @@ -19,7 +19,7 @@ pluginManagement { // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.5.2" apply false + id "com.android.application" version '8.9.1' apply false id "org.jetbrains.kotlin.android" version "1.9.0" apply false id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" } diff --git a/packages/shared_preferences/shared_preferences_android/pubspec.yaml b/packages/shared_preferences/shared_preferences_android/pubspec.yaml index 2fcf2454e40..2ff5e705eb8 100644 --- a/packages/shared_preferences/shared_preferences_android/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences_android/pubspec.yaml @@ -2,7 +2,7 @@ name: shared_preferences_android description: Android implementation of the shared_preferences plugin repository: https://github.com/flutter/packages/tree/main/packages/shared_preferences/shared_preferences_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+shared_preferences%22 -version: 2.4.9 +version: 2.4.10 environment: sdk: ^3.6.0 diff --git a/packages/url_launcher/url_launcher/CHANGELOG.md b/packages/url_launcher/url_launcher/CHANGELOG.md index 83f67b28e59..b653551a406 100644 --- a/packages/url_launcher/url_launcher/CHANGELOG.md +++ b/packages/url_launcher/url_launcher/CHANGELOG.md @@ -1,5 +1,6 @@ ## NEXT +* Updates README to indicate that Andoid SDK <21 is no longer supported. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 6.3.1 diff --git a/packages/url_launcher/url_launcher/README.md b/packages/url_launcher/url_launcher/README.md index 301c0a068e1..0c6ee7675f2 100644 --- a/packages/url_launcher/url_launcher/README.md +++ b/packages/url_launcher/url_launcher/README.md @@ -8,7 +8,7 @@ A Flutter plugin for launching a URL. | | Android | iOS | Linux | macOS | Web | Windows | |-------------|---------|-------|-------|--------|-----|-------------| -| **Support** | SDK 16+ | 12.0+ | Any | 10.14+ | Any | Windows 10+ | +| **Support** | SDK 21+ | 12.0+ | Any | 10.14+ | Any | Windows 10+ | ## Example diff --git a/packages/url_launcher/url_launcher_android/CHANGELOG.md b/packages/url_launcher/url_launcher_android/CHANGELOG.md index 7cc7b2b278d..4e3c5e9fc0c 100644 --- a/packages/url_launcher/url_launcher_android/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 6.3.16 + +* Removes obsolete code related to supporting SDK <21. + ## 6.3.15 * Updates compileSdk 34 to flutter.compileSdkVersion. diff --git a/packages/url_launcher/url_launcher_android/android/build.gradle b/packages/url_launcher/url_launcher_android/android/build.gradle index d2661a6db0f..995bac76307 100644 --- a/packages/url_launcher/url_launcher_android/android/build.gradle +++ b/packages/url_launcher/url_launcher_android/android/build.gradle @@ -29,7 +29,7 @@ android { compileSdk = flutter.compileSdkVersion defaultConfig { - minSdkVersion 19 + minSdkVersion 21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java b/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java index 4bfe12986f0..3ae49cece79 100644 --- a/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java +++ b/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java @@ -4,7 +4,6 @@ package io.flutter.plugins.urllauncher; -import android.annotation.TargetApi; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; @@ -50,27 +49,10 @@ public void onReceive(Context context, Intent intent) { private final WebViewClient webViewClient = new WebViewClient() { - - /* - * This method is deprecated in API 24. Still overridden to support - * earlier Android versions. - */ - @SuppressWarnings("deprecation") - @Override - public boolean shouldOverrideUrlLoading(WebView view, String url) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { - view.loadUrl(url); - return false; - } - return super.shouldOverrideUrlLoading(view, url); - } - @RequiresApi(Build.VERSION_CODES.N) @Override public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - view.loadUrl(request.getUrl().toString()); - } + view.loadUrl(request.getUrl().toString()); return false; } }; @@ -87,7 +69,6 @@ public boolean onCreateWindow( final WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) { final WebViewClient webViewClient = new WebViewClient() { - @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public boolean shouldOverrideUrlLoading( @NonNull WebView view, @NonNull WebResourceRequest request) { diff --git a/packages/url_launcher/url_launcher_android/pubspec.yaml b/packages/url_launcher/url_launcher_android/pubspec.yaml index 1c1d24e6840..db86a890a65 100644 --- a/packages/url_launcher/url_launcher_android/pubspec.yaml +++ b/packages/url_launcher/url_launcher_android/pubspec.yaml @@ -2,7 +2,7 @@ name: url_launcher_android description: Android implementation of the url_launcher plugin. repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22 -version: 6.3.15 +version: 6.3.16 environment: sdk: ^3.6.0 flutter: ">=3.27.0" diff --git a/packages/video_player/video_player/CHANGELOG.md b/packages/video_player/video_player/CHANGELOG.md index e36eed3374a..1b3caf42876 100644 --- a/packages/video_player/video_player/CHANGELOG.md +++ b/packages/video_player/video_player/CHANGELOG.md @@ -1,3 +1,7 @@ +## NEXT + +* Updates README to indicate that Andoid SDK <21 is no longer supported. + ## 2.9.5 * Fixes layout issue caused by `Transform.rotate` not affecting space calculation. diff --git a/packages/video_player/video_player/README.md b/packages/video_player/video_player/README.md index 094bdd66699..dcf1a6018bf 100644 --- a/packages/video_player/video_player/README.md +++ b/packages/video_player/video_player/README.md @@ -8,7 +8,7 @@ A Flutter plugin for iOS, Android and Web for playing back video on a Widget sur | | Android | iOS | macOS | Web | |-------------|---------|-------|--------|-------| -| **Support** | SDK 16+ | 12.0+ | 10.14+ | Any\* | +| **Support** | SDK 21+ | 12.0+ | 10.14+ | Any\* | ![The example app running in iOS](https://github.com/flutter/packages/blob/main/packages/video_player/video_player/doc/demo_ipod.gif?raw=true) diff --git a/packages/video_player/video_player_avfoundation/CHANGELOG.md b/packages/video_player/video_player_avfoundation/CHANGELOG.md index 81e43153e7a..992c015df1b 100644 --- a/packages/video_player/video_player_avfoundation/CHANGELOG.md +++ b/packages/video_player/video_player_avfoundation/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.7.1 + +* Adds possibility to play videos at more than 30 FPS. +* Fixes playing state not updating in some paths. + ## 2.7.0 * Adds support for platform views as an optional way of displaying a video. diff --git a/packages/video_player/video_player_avfoundation/darwin/RunnerTests/VideoPlayerTests.m b/packages/video_player/video_player_avfoundation/darwin/RunnerTests/VideoPlayerTests.m index e3c1d058728..4bb06d7d970 100644 --- a/packages/video_player/video_player_avfoundation/darwin/RunnerTests/VideoPlayerTests.m +++ b/packages/video_player/video_player_avfoundation/darwin/RunnerTests/VideoPlayerTests.m @@ -131,6 +131,7 @@ @interface StubFVPDisplayLinkFactory : NSObject /** This display link to return. */ @property(nonatomic, strong) FVPDisplayLink *displayLink; +@property(nonatomic, copy) void (^fireDisplayLink)(void); - (instancetype)initWithDisplayLink:(FVPDisplayLink *)displayLink; @@ -144,6 +145,7 @@ - (instancetype)initWithDisplayLink:(FVPDisplayLink *)displayLink { } - (FVPDisplayLink *)displayLinkWithRegistrar:(id)registrar callback:(void (^)(void))callback { + self.fireDisplayLink = callback; return self.displayLink; } @@ -321,13 +323,14 @@ - (void)testSeekToWhilePausedStartsDisplayLinkTemporarily { OCMStub([mockVideoOutput hasNewPixelBufferForItemTime:kCMTimeZero]) .ignoringNonObjectArgs() .andReturn(YES); - // Any non-zero value is fine here since it won't actually be used, just NULL-checked. - CVPixelBufferRef fakeBufferRef = (CVPixelBufferRef)1; + CVPixelBufferRef bufferRef; + CVPixelBufferCreate(NULL, 1, 1, kCVPixelFormatType_32BGRA, NULL, &bufferRef); OCMStub([mockVideoOutput copyPixelBufferForItemTime:kCMTimeZero itemTimeForDisplay:NULL]) .ignoringNonObjectArgs() - .andReturn(fakeBufferRef); + .andReturn(bufferRef); // Simulate a callback from the engine to request a new frame. - [player copyPixelBuffer]; + stubDisplayLinkFactory.fireDisplayLink(); + CFRelease([player copyPixelBuffer]); // Since a frame was found, and the video is paused, the display link should be paused again. OCMVerify([mockDisplayLink setRunning:NO]); } @@ -373,15 +376,16 @@ - (void)testInitStartsDisplayLinkTemporarily { OCMStub([mockVideoOutput hasNewPixelBufferForItemTime:kCMTimeZero]) .ignoringNonObjectArgs() .andReturn(YES); - // Any non-zero value is fine here since it won't actually be used, just NULL-checked. - CVPixelBufferRef fakeBufferRef = (CVPixelBufferRef)1; + CVPixelBufferRef bufferRef; + CVPixelBufferCreate(NULL, 1, 1, kCVPixelFormatType_32BGRA, NULL, &bufferRef); OCMStub([mockVideoOutput copyPixelBufferForItemTime:kCMTimeZero itemTimeForDisplay:NULL]) .ignoringNonObjectArgs() - .andReturn(fakeBufferRef); + .andReturn(bufferRef); // Simulate a callback from the engine to request a new frame. FVPTextureBasedVideoPlayer *player = (FVPTextureBasedVideoPlayer *)videoPlayerPlugin.playersByIdentifier[playerIdentifier]; - [player copyPixelBuffer]; + stubDisplayLinkFactory.fireDisplayLink(); + CFRelease([player copyPixelBuffer]); // Since a frame was found, and the video is paused, the display link should be paused again. OCMVerify([mockDisplayLink setRunning:NO]); } @@ -433,19 +437,25 @@ - (void)testSeekToWhilePlayingDoesNotStopDisplayLink { FVPTextureBasedVideoPlayer *player = (FVPTextureBasedVideoPlayer *)videoPlayerPlugin.playersByIdentifier[playerIdentifier]; - XCTAssertEqual([player position], 1234); + // Wait for the player's position to update, it shouldn't take long. + XCTestExpectation *positionExpectation = + [self expectationForPredicate:[NSPredicate predicateWithFormat:@"position == 1234"] + evaluatedWithObject:player + handler:nil]; + [self waitForExpectations:@[ positionExpectation ] timeout:3.0]; // Simulate a buffer being available. OCMStub([mockVideoOutput hasNewPixelBufferForItemTime:kCMTimeZero]) .ignoringNonObjectArgs() .andReturn(YES); - // Any non-zero value is fine here since it won't actually be used, just NULL-checked. - CVPixelBufferRef fakeBufferRef = (CVPixelBufferRef)1; + CVPixelBufferRef bufferRef; + CVPixelBufferCreate(NULL, 1, 1, kCVPixelFormatType_32BGRA, NULL, &bufferRef); OCMStub([mockVideoOutput copyPixelBufferForItemTime:kCMTimeZero itemTimeForDisplay:NULL]) .ignoringNonObjectArgs() - .andReturn(fakeBufferRef); + .andReturn(bufferRef); // Simulate a callback from the engine to request a new frame. - [player copyPixelBuffer]; + stubDisplayLinkFactory.fireDisplayLink(); + CFRelease([player copyPixelBuffer]); // Since the video was playing, the display link should not be paused after getting a buffer. OCMVerify(never(), [mockDisplayLink setRunning:NO]); } @@ -994,6 +1004,84 @@ - (void)testUpdatePlayingStateShouldNotResetRate { XCTAssertEqual(player.player.rate, 2); } +- (void)testPlayerShouldNotDropEverySecondFrame { + NSObject *registrar = + [GetPluginRegistry() registrarForPlugin:@"testPlayerShouldNotDropEverySecondFrame"]; + NSObject *partialRegistrar = OCMPartialMock(registrar); + NSObject *mockTextureRegistry = + OCMProtocolMock(@protocol(FlutterTextureRegistry)); + OCMStub([partialRegistrar textures]).andReturn(mockTextureRegistry); + + FVPDisplayLink *displayLink = [[FVPDisplayLink alloc] initWithRegistrar:registrar + callback:^(){ + }]; + StubFVPDisplayLinkFactory *stubDisplayLinkFactory = + [[StubFVPDisplayLinkFactory alloc] initWithDisplayLink:displayLink]; + AVPlayerItemVideoOutput *mockVideoOutput = OCMPartialMock([[AVPlayerItemVideoOutput alloc] init]); + FVPVideoPlayerPlugin *videoPlayerPlugin = [[FVPVideoPlayerPlugin alloc] + initWithAVFactory:[[StubFVPAVFactory alloc] initWithPlayer:nil output:mockVideoOutput] + displayLinkFactory:stubDisplayLinkFactory + registrar:partialRegistrar]; + + FlutterError *error; + [videoPlayerPlugin initialize:&error]; + XCTAssertNil(error); + FVPCreationOptions *create = [FVPCreationOptions + makeWithAsset:nil + uri:@"https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4" + packageName:nil + formatHint:nil + httpHeaders:@{} + viewType:FVPPlatformVideoViewTypeTextureView]; + NSNumber *playerIdentifier = [videoPlayerPlugin createWithOptions:create error:&error]; + FVPTextureBasedVideoPlayer *player = + (FVPTextureBasedVideoPlayer *)videoPlayerPlugin.playersByIdentifier[playerIdentifier]; + + __block CMTime currentTime = kCMTimeZero; + OCMStub([mockVideoOutput itemTimeForHostTime:0]) + .ignoringNonObjectArgs() + .andDo(^(NSInvocation *invocation) { + [invocation setReturnValue:¤tTime]; + }); + __block NSMutableSet *pixelBuffers = NSMutableSet.new; + OCMStub([mockVideoOutput hasNewPixelBufferForItemTime:kCMTimeZero]) + .ignoringNonObjectArgs() + .andDo(^(NSInvocation *invocation) { + CMTime itemTime; + [invocation getArgument:&itemTime atIndex:2]; + BOOL has = [pixelBuffers containsObject:[NSValue valueWithCMTime:itemTime]]; + [invocation setReturnValue:&has]; + }); + OCMStub([mockVideoOutput copyPixelBufferForItemTime:kCMTimeZero + itemTimeForDisplay:[OCMArg anyPointer]]) + .ignoringNonObjectArgs() + .andDo(^(NSInvocation *invocation) { + CMTime itemTime; + [invocation getArgument:&itemTime atIndex:2]; + CVPixelBufferRef bufferRef = NULL; + if ([pixelBuffers containsObject:[NSValue valueWithCMTime:itemTime]]) { + CVPixelBufferCreate(NULL, 1, 1, kCVPixelFormatType_32BGRA, NULL, &bufferRef); + } + [pixelBuffers removeObject:[NSValue valueWithCMTime:itemTime]]; + [invocation setReturnValue:&bufferRef]; + }); + void (^advanceFrame)(void) = ^{ + currentTime.value++; + [pixelBuffers addObject:[NSValue valueWithCMTime:currentTime]]; + }; + + advanceFrame(); + OCMExpect([mockTextureRegistry textureFrameAvailable:playerIdentifier.intValue]); + stubDisplayLinkFactory.fireDisplayLink(); + OCMVerifyAllWithDelay(mockTextureRegistry, 10); + + advanceFrame(); + OCMExpect([mockTextureRegistry textureFrameAvailable:playerIdentifier.intValue]); + CFRelease([player copyPixelBuffer]); + stubDisplayLinkFactory.fireDisplayLink(); + OCMVerifyAllWithDelay(mockTextureRegistry, 10); +} + #if TARGET_OS_IOS - (void)testVideoPlayerShouldNotOverwritePlayAndRecordNorDefaultToSpeaker { NSObject *registrar = [GetPluginRegistry() diff --git a/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPFrameUpdater.m b/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPFrameUpdater.m index e73d486da17..0c66f6f639b 100644 --- a/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPFrameUpdater.m +++ b/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPFrameUpdater.m @@ -4,28 +4,16 @@ #import "./include/video_player_avfoundation/FVPFrameUpdater.h" -/// FVPFrameUpdater is responsible for notifying the Flutter texture registry -/// when a new video frame is available. -@interface FVPFrameUpdater () -/// The Flutter texture registry used to notify about new frames. -@property(nonatomic, weak, readonly) NSObject *registry; -@end - @implementation FVPFrameUpdater - (FVPFrameUpdater *)initWithRegistry:(NSObject *)registry { NSAssert(self, @"super init cannot be nil"); if (self == nil) return nil; _registry = registry; - _lastKnownAvailableTime = kCMTimeInvalid; return self; } - (void)displayLinkFired { - // Only report a new frame if one is actually available. - CMTime outputItemTime = [self.videoOutput itemTimeForHostTime:CACurrentMediaTime()]; - if ([self.videoOutput hasNewPixelBufferForItemTime:outputItemTime]) { - _lastKnownAvailableTime = outputItemTime; - [_registry textureFrameAvailable:_textureIdentifier]; - } + self.frameDuration = _displayLink.duration; + [_registry textureFrameAvailable:_textureIdentifier]; } @end diff --git a/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPTextureBasedVideoPlayer.m b/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPTextureBasedVideoPlayer.m index 509d0b5e55a..68f8a4673c6 100644 --- a/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPTextureBasedVideoPlayer.m +++ b/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPTextureBasedVideoPlayer.m @@ -12,6 +12,20 @@ @interface FVPTextureBasedVideoPlayer () @property(nonatomic) FVPFrameUpdater *frameUpdater; // The display link that drives frameUpdater. @property(nonatomic) FVPDisplayLink *displayLink; +// The latest buffer obtained from video output. This is stored so that it can be returned from +// copyPixelBuffer again if nothing new is available, since the engine has undefined behavior when +// returning NULL. +@property(nonatomic) CVPixelBufferRef latestPixelBuffer; +// The time that represents when the next frame displays. +@property(nonatomic) CFTimeInterval targetTime; +// Whether to enqueue textureFrameAvailable from copyPixelBuffer. +@property(nonatomic) BOOL selfRefresh; +// The time that represents the start of average frame duration measurement. +@property(nonatomic) CFTimeInterval startTime; +// The number of frames since the start of average frame duration measurement. +@property(nonatomic) int framesCount; +// The latest frame duration since there was significant change. +@property(nonatomic) CFTimeInterval latestDuration; // Whether a new frame needs to be provided to the engine regardless of the current play/pause state // (e.g., after a seek while paused). If YES, the display link should continue to run until the next // frame is successfully provided. @@ -67,7 +81,8 @@ - (instancetype)initWithPlayerItem:(AVPlayerItem *)item if (self) { _frameUpdater = frameUpdater; _displayLink = displayLink; - _frameUpdater.videoOutput = self.videoOutput; + _frameUpdater.displayLink = _displayLink; + _selfRefresh = true; _onDisposed = [onDisposed copy]; // This is to fix 2 bugs: 1. blank video for encrypted video streams on iOS 16 @@ -81,6 +96,10 @@ - (instancetype)initWithPlayerItem:(AVPlayerItem *)item return self; } +- (void)dealloc { + CVBufferRelease(_latestPixelBuffer); +} + - (void)setTextureIdentifier:(int64_t)textureIdentifier { self.frameUpdater.textureIdentifier = textureIdentifier; } @@ -161,17 +180,32 @@ - (void)dispose { #pragma mark - FlutterTexture - (CVPixelBufferRef)copyPixelBuffer { + // If the difference between target time and current time is longer than this fraction of frame + // duration then reset target time. + const float resetThreshold = 0.5; + + // Ensure video sampling at regular intervals. This function is not called at exact time intervals + // so CACurrentMediaTime returns irregular timestamps which causes missed video frames. The range + // outside of which targetTime is reset should be narrow enough to make possible lag as small as + // possible and at the same time wide enough to avoid too frequent resets which would lead to + // irregular sampling. + // TODO: Ideally there would be a targetTimestamp of display link used by the flutter engine. + // https://github.com/flutter/flutter/issues/159087 + CFTimeInterval currentTime = CACurrentMediaTime(); + CFTimeInterval duration = self.frameUpdater.frameDuration; + if (fabs(self.targetTime - currentTime) > duration * resetThreshold) { + self.targetTime = currentTime; + } + self.targetTime += duration; + CVPixelBufferRef buffer = NULL; - CMTime outputItemTime = [self.videoOutput itemTimeForHostTime:CACurrentMediaTime()]; + CMTime outputItemTime = [self.videoOutput itemTimeForHostTime:self.targetTime]; if ([self.videoOutput hasNewPixelBufferForItemTime:outputItemTime]) { buffer = [self.videoOutput copyPixelBufferForItemTime:outputItemTime itemTimeForDisplay:NULL]; - } else { - // If the current time isn't available yet, use the time that was checked when informing the - // engine that a frame was available (if any). - CMTime lastAvailableTime = self.frameUpdater.lastKnownAvailableTime; - if (CMTIME_IS_VALID(lastAvailableTime)) { - buffer = [self.videoOutput copyPixelBufferForItemTime:lastAvailableTime - itemTimeForDisplay:NULL]; + if (buffer) { + // Balance the owned reference from copyPixelBufferForItemTime. + CVBufferRelease(self.latestPixelBuffer); + self.latestPixelBuffer = buffer; } } @@ -184,7 +218,48 @@ - (CVPixelBufferRef)copyPixelBuffer { } } - return buffer; + // Calling textureFrameAvailable only from within displayLinkFired would require a non-trivial + // solution to minimize missed video frames due to race between displayLinkFired, copyPixelBuffer + // and place where is _textureFrameAvailable reset to false in the flutter engine. + // TODO: Ideally FlutterTexture would support mode of operation where the copyPixelBuffer is + // called always or some other alternative, instead of on demand by calling textureFrameAvailable. + // https://github.com/flutter/flutter/issues/159162 + if (self.displayLink.running && self.selfRefresh) { + // The number of frames over which to measure average frame duration. + const int windowSize = 10; + // If measured average frame duration is shorter than this fraction of frame duration obtained + // from display link then rely solely on refreshes from display link. + const float durationThreshold = 0.5; + // If duration changes by this fraction or more then reset average frame duration measurement. + const float resetFraction = 0.01; + + if (fabs(duration - self.latestDuration) >= self.latestDuration * resetFraction) { + self.startTime = currentTime; + self.framesCount = 0; + self.latestDuration = duration; + } + if (self.framesCount == windowSize) { + CFTimeInterval averageDuration = (currentTime - self.startTime) / windowSize; + if (averageDuration < duration * durationThreshold) { + NSLog(@"Warning: measured average duration between frames is unexpectedly short (%f/%f), " + @"please report this to " + @"https://github.com/flutter/flutter/issues.", + averageDuration, duration); + self.selfRefresh = false; + } + self.startTime = currentTime; + self.framesCount = 0; + } + self.framesCount++; + + dispatch_async(dispatch_get_main_queue(), ^{ + [self.frameUpdater.registry textureFrameAvailable:self.frameUpdater.textureIdentifier]; + }); + } + + // Add a retain for the engine, since the copyPixelBufferForItemTime has already been accounted + // for, and the engine expects an owning reference. + return CVBufferRetain(self.latestPixelBuffer); } - (void)onTextureUnregistered:(NSObject *)texture { diff --git a/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPVideoPlayer.m b/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPVideoPlayer.m index d1d096e7b28..04d6d21cb2e 100644 --- a/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPVideoPlayer.m +++ b/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPVideoPlayer.m @@ -60,6 +60,10 @@ - (instancetype)initWithPlayerItem:(AVPlayerItem *)item error:nil] == AVKeyValueStatusLoaded) { // Rotate the video by using a videoComposition and the preferredTransform self->_preferredTransform = FVPGetStandardizedTransformForTrack(videoTrack); + // Do not use video composition when it is not needed. + if (CGAffineTransformIsIdentity(self->_preferredTransform)) { + return; + } // Note: // https://developer.apple.com/documentation/avfoundation/avplayeritem/1388818-videocomposition // Video composition can only be used with file-based media and is not supported for @@ -207,9 +211,14 @@ - (AVMutableVideoComposition *)getVideoCompositionWithTransform:(CGAffineTransfo } videoComposition.renderSize = CGSizeMake(width, height); - // TODO(@recastrodiaz): should we use videoTrack.nominalFrameRate ? - // Currently set at a constant 30 FPS - videoComposition.frameDuration = CMTimeMake(1, 30); + videoComposition.sourceTrackIDForFrameTiming = videoTrack.trackID; + if (CMTIME_IS_VALID(videoTrack.minFrameDuration)) { + videoComposition.frameDuration = videoTrack.minFrameDuration; + } else { + NSLog(@"Warning: videoTrack.minFrameDuration for input video is invalid, please report this to " + @"https://github.com/flutter/flutter/issues with input video attached."); + videoComposition.frameDuration = CMTimeMake(1, 30); + } return videoComposition; } @@ -239,7 +248,6 @@ - (void)observeValueForKeyPath:(NSString *)path case AVPlayerItemStatusReadyToPlay: [item addOutput:_videoOutput]; [self setupEventSinkIfReadyToPlay]; - [self updatePlayingState]; break; } } else if (context == presentationSizeContext || context == durationContext) { @@ -249,7 +257,6 @@ - (void)observeValueForKeyPath:(NSString *)path // its presentation size or duration. When these properties are finally set, re-check if // all required properties and instantiate the event sink if it is not already set up. [self setupEventSinkIfReadyToPlay]; - [self updatePlayingState]; } } else if (context == playbackLikelyToKeepUpContext) { [self updatePlayingState]; @@ -387,6 +394,8 @@ - (void)setupEventSinkIfReadyToPlay { } _isInitialized = YES; + [self updatePlayingState]; + _eventSink(@{ @"event" : @"initialized", @"duration" : @(duration), diff --git a/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/FVPDisplayLink.h b/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/FVPDisplayLink.h index 80d400629b2..54e338993c4 100644 --- a/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/FVPDisplayLink.h +++ b/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/FVPDisplayLink.h @@ -18,6 +18,9 @@ /// Defaults to NO. @property(nonatomic, assign) BOOL running; +/// The time interval between screen refresh updates. +@property(nonatomic, readonly) CFTimeInterval duration; + /// Initializes a display link that calls the given callback when fired. /// /// The display link starts paused, so must be started, by setting 'running' to YES, before the diff --git a/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/FVPFrameUpdater.h b/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/FVPFrameUpdater.h index 9d5466d8757..274b666f287 100644 --- a/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/FVPFrameUpdater.h +++ b/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/FVPFrameUpdater.h @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import +#import "FVPDisplayLink.h" #if TARGET_OS_OSX #import @@ -17,10 +17,13 @@ NS_ASSUME_NONNULL_BEGIN @interface FVPFrameUpdater : NSObject /// The texture identifier associated with the video output. @property(nonatomic) int64_t textureIdentifier; -/// The output that this updater is managing. -@property(nonatomic, weak) AVPlayerItemVideoOutput *videoOutput; -/// The last time that has been validated as avaliable according to hasNewPixelBufferForItemTime:. -@property(readonly, nonatomic, assign) CMTime lastKnownAvailableTime; +/// The Flutter texture registry used to notify about new frames. +@property(nonatomic, weak, readonly) NSObject *registry; +/// The display link that drives frameUpdater. +@property(nonatomic) FVPDisplayLink *displayLink; +/// The time interval between screen refresh updates. Display link duration is in an undefined state +/// until displayLinkFired is called at least once so it should not be used directly. +@property(atomic) CFTimeInterval frameDuration; /// Initializes a new instance of FVPFrameUpdater with the given Flutter texture registry. - (FVPFrameUpdater *)initWithRegistry:(NSObject *)registry; diff --git a/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation_ios/FVPDisplayLink.m b/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation_ios/FVPDisplayLink.m index 9bdb321ae16..5ea6ea0135d 100644 --- a/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation_ios/FVPDisplayLink.m +++ b/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation_ios/FVPDisplayLink.m @@ -67,4 +67,8 @@ - (void)setRunning:(BOOL)running { self.displayLink.paused = !running; } +- (CFTimeInterval)duration { + return self.displayLink.duration; +} + @end diff --git a/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation_macos/FVPDisplayLink.m b/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation_macos/FVPDisplayLink.m index cd5670fa5a3..cb9682e6011 100644 --- a/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation_macos/FVPDisplayLink.m +++ b/packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation_macos/FVPDisplayLink.m @@ -81,4 +81,12 @@ - (void)setRunning:(BOOL)running { } } +- (CFTimeInterval)duration { + CVTimeStamp timestamp = {.version = 0}; + if (CVDisplayLinkGetCurrentTime(self.displayLink, ×tamp) != kCVReturnSuccess) { + return 0; + } + return (CFTimeInterval)timestamp.videoRefreshPeriod / timestamp.videoTimeScale; +} + @end diff --git a/packages/video_player/video_player_avfoundation/pubspec.yaml b/packages/video_player/video_player_avfoundation/pubspec.yaml index 3db089c7ccf..20087db42cc 100644 --- a/packages/video_player/video_player_avfoundation/pubspec.yaml +++ b/packages/video_player/video_player_avfoundation/pubspec.yaml @@ -2,7 +2,7 @@ name: video_player_avfoundation description: iOS and macOS implementation of the video_player plugin. repository: https://github.com/flutter/packages/tree/main/packages/video_player/video_player_avfoundation issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22 -version: 2.7.0 +version: 2.7.1 environment: sdk: ^3.4.0 diff --git a/packages/webview_flutter/webview_flutter/CHANGELOG.md b/packages/webview_flutter/webview_flutter/CHANGELOG.md index 1d95b3b902a..333296aa501 100644 --- a/packages/webview_flutter/webview_flutter/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter/CHANGELOG.md @@ -1,6 +1,11 @@ ## NEXT -* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. +* Updates README to indicate that Andoid SDK <21 is no longer supported. + +## 4.11.0 + +* Adds support to set the over-scroll mode for the WebView. See `WebViewController.setOverScrollMode`. +* Updates minimum supported SDK version to Flutter 3.27/Dart 3.6. ## 4.10.0 diff --git a/packages/webview_flutter/webview_flutter/README.md b/packages/webview_flutter/webview_flutter/README.md index fbd6d50e2fd..eaab72089d7 100644 --- a/packages/webview_flutter/webview_flutter/README.md +++ b/packages/webview_flutter/webview_flutter/README.md @@ -60,22 +60,6 @@ See the Dartdocs for [WebViewController](https://pub.dev/documentation/webview_f and [WebViewWidget](https://pub.dev/documentation/webview_flutter/latest/webview_flutter/WebViewWidget-class.html) for more details. -### Android Platform Views - -This plugin uses -[Platform Views](https://docs.flutter.dev/platform-integration/android/platform-views) to -embed the Android's WebView within the Flutter app. - -You should however make sure to set the correct `minSdkVersion` in `android/app/build.gradle` if it was previously lower than 19: - -```groovy -android { - defaultConfig { - minSdkVersion 19 - } -} -``` - ### Platform-Specific Features Many classes have a subclass or an underlying implementation that provides access to platform-specific @@ -175,7 +159,7 @@ for more details. ### PlatformView Implementation on Android The PlatformView implementation for Android uses Texture Layer Hybrid Composition on versions 23+ -and automatically fallbacks to Hybrid Composition for version 19-23. See section +and automatically fallbacks to Hybrid Composition for version 21-23. See section `Platform-Specific Features` and [AndroidWebViewWidgetCreationParams.displayWithHybridComposition](https://pub.dev/documentation/webview_flutter_android/latest/webview_flutter_android/AndroidWebViewWidgetCreationParams/displayWithHybridComposition.html) to manually switch to Hybrid Composition on versions 23+. diff --git a/packages/webview_flutter/webview_flutter/example/pubspec.yaml b/packages/webview_flutter/webview_flutter/example/pubspec.yaml index e6152419a9a..5c0fb7ecf99 100644 --- a/packages/webview_flutter/webview_flutter/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter/example/pubspec.yaml @@ -17,8 +17,8 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - webview_flutter_android: ^4.0.0 - webview_flutter_wkwebview: ^3.13.0 + webview_flutter_android: ^4.4.0 + webview_flutter_wkwebview: ^3.19.0 dev_dependencies: build_runner: ^2.1.5 @@ -27,7 +27,7 @@ dev_dependencies: sdk: flutter integration_test: sdk: flutter - webview_flutter_platform_interface: ^2.10.0 + webview_flutter_platform_interface: ^2.11.0 flutter: uses-material-design: true diff --git a/packages/webview_flutter/webview_flutter/lib/src/webview_controller.dart b/packages/webview_flutter/webview_flutter/lib/src/webview_controller.dart index 603f9cf4be3..6b720c9c753 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/webview_controller.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/webview_controller.dart @@ -405,6 +405,13 @@ class WebViewController { ) { return platform.setOnScrollPositionChange(onScrollPositionChange); } + + /// Sets the over-scroll mode for the WebView. + /// + /// Default behavior is platform dependent. + Future setOverScrollMode(WebViewOverScrollMode mode) async { + return platform.setOverScrollMode(mode); + } } /// Permissions request when web content requests access to protected resources. diff --git a/packages/webview_flutter/webview_flutter/lib/webview_flutter.dart b/packages/webview_flutter/webview_flutter/lib/webview_flutter.dart index e135e3c5bcb..b1b237d3140 100644 --- a/packages/webview_flutter/webview_flutter/lib/webview_flutter.dart +++ b/packages/webview_flutter/webview_flutter/lib/webview_flutter.dart @@ -34,6 +34,7 @@ export 'package:webview_flutter_platform_interface/webview_flutter_platform_inte WebResourceResponse, WebViewCookie, WebViewCredential, + WebViewOverScrollMode, WebViewPermissionResourceType, WebViewPlatform; diff --git a/packages/webview_flutter/webview_flutter/pubspec.yaml b/packages/webview_flutter/webview_flutter/pubspec.yaml index 837800d7fee..c609edc11ff 100644 --- a/packages/webview_flutter/webview_flutter/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter/pubspec.yaml @@ -2,11 +2,11 @@ name: webview_flutter description: A Flutter plugin that provides a WebView widget backed by the system webview. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 4.10.0 +version: 4.11.0 environment: - sdk: ^3.5.0 - flutter: ">=3.24.0" + sdk: ^3.6.0 + flutter: ">=3.27.0" flutter: plugin: @@ -21,9 +21,9 @@ flutter: dependencies: flutter: sdk: flutter - webview_flutter_android: ^4.0.0 - webview_flutter_platform_interface: ^2.10.0 - webview_flutter_wkwebview: ^3.15.0 + webview_flutter_android: ^4.4.0 + webview_flutter_platform_interface: ^2.11.0 + webview_flutter_wkwebview: ^3.19.0 dev_dependencies: build_runner: ^2.1.5 diff --git a/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.mocks.dart index ff3f06b0e65..7a3c4d583a9 100644 --- a/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter/test/legacy/webview_flutter_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.5 from annotations // in webview_flutter/test/legacy/webview_flutter_test.dart. // Do not manually edit this file. @@ -29,19 +29,15 @@ import 'package:webview_flutter_platform_interface/src/legacy/types/types.dart' // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class class _FakeWidget_0 extends _i1.SmartFake implements _i2.Widget { - _FakeWidget_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWidget_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); @override String toString({_i3.DiagnosticLevel? minLevel = _i3.DiagnosticLevel.info}) => @@ -67,41 +63,30 @@ class MockWebViewPlatform extends _i1.Mock implements _i4.WebViewPlatform { Set<_i3.Factory<_i8.OneSequenceGestureRecognizer>>? gestureRecognizers, }) => (super.noSuchMethod( - Invocation.method( - #build, - [], - { + Invocation.method(#build, [], { + #context: context, + #creationParams: creationParams, + #webViewPlatformCallbacksHandler: webViewPlatformCallbacksHandler, + #javascriptChannelRegistry: javascriptChannelRegistry, + #onWebViewPlatformCreated: onWebViewPlatformCreated, + #gestureRecognizers: gestureRecognizers, + }), + returnValue: _FakeWidget_0( + this, + Invocation.method(#build, [], { #context: context, #creationParams: creationParams, #webViewPlatformCallbacksHandler: webViewPlatformCallbacksHandler, #javascriptChannelRegistry: javascriptChannelRegistry, #onWebViewPlatformCreated: onWebViewPlatformCreated, #gestureRecognizers: gestureRecognizers, - }, - ), - returnValue: _FakeWidget_0( - this, - Invocation.method( - #build, - [], - { - #context: context, - #creationParams: creationParams, - #webViewPlatformCallbacksHandler: webViewPlatformCallbacksHandler, - #javascriptChannelRegistry: javascriptChannelRegistry, - #onWebViewPlatformCreated: onWebViewPlatformCreated, - #gestureRecognizers: gestureRecognizers, - }, - ), + }), ), ) as _i2.Widget); @override _i9.Future clearCookies() => (super.noSuchMethod( - Invocation.method( - #clearCookies, - [], - ), + Invocation.method(#clearCookies, []), returnValue: _i9.Future.value(false), ) as _i9.Future); } @@ -117,52 +102,30 @@ class MockWebViewPlatformController extends _i1.Mock @override _i9.Future loadFile(String? absoluteFilePath) => (super.noSuchMethod( - Invocation.method( - #loadFile, - [absoluteFilePath], - ), + Invocation.method(#loadFile, [absoluteFilePath]), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future loadFlutterAsset(String? key) => (super.noSuchMethod( - Invocation.method( - #loadFlutterAsset, - [key], - ), + Invocation.method(#loadFlutterAsset, [key]), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - _i9.Future loadHtmlString( - String? html, { - String? baseUrl, - }) => + _i9.Future loadHtmlString(String? html, {String? baseUrl}) => (super.noSuchMethod( - Invocation.method( - #loadHtmlString, - [html], - {#baseUrl: baseUrl}, - ), + Invocation.method(#loadHtmlString, [html], {#baseUrl: baseUrl}), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - _i9.Future loadUrl( - String? url, - Map? headers, - ) => + _i9.Future loadUrl(String? url, Map? headers) => (super.noSuchMethod( - Invocation.method( - #loadUrl, - [ - url, - headers, - ], - ), + Invocation.method(#loadUrl, [url, headers]), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @@ -170,10 +133,7 @@ class MockWebViewPlatformController extends _i1.Mock @override _i9.Future loadRequest(_i5.WebViewRequest? request) => (super.noSuchMethod( - Invocation.method( - #loadRequest, - [request], - ), + Invocation.method(#loadRequest, [request]), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @@ -181,77 +141,53 @@ class MockWebViewPlatformController extends _i1.Mock @override _i9.Future updateSettings(_i5.WebSettings? setting) => (super.noSuchMethod( - Invocation.method( - #updateSettings, - [setting], - ), + Invocation.method(#updateSettings, [setting]), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future currentUrl() => (super.noSuchMethod( - Invocation.method( - #currentUrl, - [], - ), + Invocation.method(#currentUrl, []), returnValue: _i9.Future.value(), ) as _i9.Future); @override _i9.Future canGoBack() => (super.noSuchMethod( - Invocation.method( - #canGoBack, - [], - ), + Invocation.method(#canGoBack, []), returnValue: _i9.Future.value(false), ) as _i9.Future); @override _i9.Future canGoForward() => (super.noSuchMethod( - Invocation.method( - #canGoForward, - [], - ), + Invocation.method(#canGoForward, []), returnValue: _i9.Future.value(false), ) as _i9.Future); @override _i9.Future goBack() => (super.noSuchMethod( - Invocation.method( - #goBack, - [], - ), + Invocation.method(#goBack, []), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future goForward() => (super.noSuchMethod( - Invocation.method( - #goForward, - [], - ), + Invocation.method(#goForward, []), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future reload() => (super.noSuchMethod( - Invocation.method( - #reload, - [], - ), + Invocation.method(#reload, []), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future clearCache() => (super.noSuchMethod( - Invocation.method( - #clearCache, - [], - ), + Invocation.method(#clearCache, []), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @@ -259,25 +195,18 @@ class MockWebViewPlatformController extends _i1.Mock @override _i9.Future evaluateJavascript(String? javascript) => (super.noSuchMethod( - Invocation.method( - #evaluateJavascript, - [javascript], - ), - returnValue: _i9.Future.value(_i11.dummyValue( - this, - Invocation.method( - #evaluateJavascript, - [javascript], + Invocation.method(#evaluateJavascript, [javascript]), + returnValue: _i9.Future.value( + _i11.dummyValue( + this, + Invocation.method(#evaluateJavascript, [javascript]), ), - )), + ), ) as _i9.Future); @override _i9.Future runJavascript(String? javascript) => (super.noSuchMethod( - Invocation.method( - #runJavascript, - [javascript], - ), + Invocation.method(#runJavascript, [javascript]), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @@ -285,100 +214,64 @@ class MockWebViewPlatformController extends _i1.Mock @override _i9.Future runJavascriptReturningResult(String? javascript) => (super.noSuchMethod( - Invocation.method( - #runJavascriptReturningResult, - [javascript], - ), - returnValue: _i9.Future.value(_i11.dummyValue( - this, - Invocation.method( - #runJavascriptReturningResult, - [javascript], + Invocation.method(#runJavascriptReturningResult, [javascript]), + returnValue: _i9.Future.value( + _i11.dummyValue( + this, + Invocation.method(#runJavascriptReturningResult, [javascript]), ), - )), + ), ) as _i9.Future); @override _i9.Future addJavascriptChannels(Set? javascriptChannelNames) => (super.noSuchMethod( - Invocation.method( - #addJavascriptChannels, - [javascriptChannelNames], - ), + Invocation.method(#addJavascriptChannels, [javascriptChannelNames]), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future removeJavascriptChannels( - Set? javascriptChannelNames) => + Set? javascriptChannelNames, + ) => (super.noSuchMethod( - Invocation.method( - #removeJavascriptChannels, - [javascriptChannelNames], - ), + Invocation.method(#removeJavascriptChannels, [ + javascriptChannelNames, + ]), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future getTitle() => (super.noSuchMethod( - Invocation.method( - #getTitle, - [], - ), + Invocation.method(#getTitle, []), returnValue: _i9.Future.value(), ) as _i9.Future); @override - _i9.Future scrollTo( - int? x, - int? y, - ) => - (super.noSuchMethod( - Invocation.method( - #scrollTo, - [ - x, - y, - ], - ), + _i9.Future scrollTo(int? x, int? y) => (super.noSuchMethod( + Invocation.method(#scrollTo, [x, y]), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - _i9.Future scrollBy( - int? x, - int? y, - ) => - (super.noSuchMethod( - Invocation.method( - #scrollBy, - [ - x, - y, - ], - ), + _i9.Future scrollBy(int? x, int? y) => (super.noSuchMethod( + Invocation.method(#scrollBy, [x, y]), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future getScrollX() => (super.noSuchMethod( - Invocation.method( - #getScrollX, - [], - ), + Invocation.method(#getScrollX, []), returnValue: _i9.Future.value(0), ) as _i9.Future); @override _i9.Future getScrollY() => (super.noSuchMethod( - Invocation.method( - #getScrollY, - [], - ), + Invocation.method(#getScrollY, []), returnValue: _i9.Future.value(0), ) as _i9.Future); } diff --git a/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.mocks.dart index 883191779cc..4b02c37ace2 100644 --- a/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.5 from annotations // in webview_flutter/test/navigation_delegate_test.dart. // Do not manually edit this file. @@ -26,6 +26,7 @@ import 'package:webview_flutter_platform_interface/src/webview_platform.dart' // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types @@ -36,43 +37,25 @@ class _FakePlatformWebViewCookieManager_0 extends _i1.SmartFake _FakePlatformWebViewCookieManager_0( Object parent, Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + ) : super(parent, parentInvocation); } class _FakePlatformNavigationDelegate_1 extends _i1.SmartFake implements _i3.PlatformNavigationDelegate { - _FakePlatformNavigationDelegate_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakePlatformNavigationDelegate_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakePlatformWebViewController_2 extends _i1.SmartFake implements _i4.PlatformWebViewController { - _FakePlatformWebViewController_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakePlatformWebViewController_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakePlatformWebViewWidget_3 extends _i1.SmartFake implements _i5.PlatformWebViewWidget { - _FakePlatformWebViewWidget_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakePlatformWebViewWidget_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakePlatformNavigationDelegateCreationParams_4 extends _i1.SmartFake @@ -80,10 +63,7 @@ class _FakePlatformNavigationDelegateCreationParams_4 extends _i1.SmartFake _FakePlatformNavigationDelegateCreationParams_4( Object parent, Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + ) : super(parent, parentInvocation); } /// A class which mocks [WebViewPlatform]. @@ -96,69 +76,49 @@ class MockWebViewPlatform extends _i1.Mock implements _i7.WebViewPlatform { @override _i2.PlatformWebViewCookieManager createPlatformCookieManager( - _i6.PlatformWebViewCookieManagerCreationParams? params) => + _i6.PlatformWebViewCookieManagerCreationParams? params, + ) => (super.noSuchMethod( - Invocation.method( - #createPlatformCookieManager, - [params], - ), + Invocation.method(#createPlatformCookieManager, [params]), returnValue: _FakePlatformWebViewCookieManager_0( this, - Invocation.method( - #createPlatformCookieManager, - [params], - ), + Invocation.method(#createPlatformCookieManager, [params]), ), ) as _i2.PlatformWebViewCookieManager); @override _i3.PlatformNavigationDelegate createPlatformNavigationDelegate( - _i6.PlatformNavigationDelegateCreationParams? params) => + _i6.PlatformNavigationDelegateCreationParams? params, + ) => (super.noSuchMethod( - Invocation.method( - #createPlatformNavigationDelegate, - [params], - ), + Invocation.method(#createPlatformNavigationDelegate, [params]), returnValue: _FakePlatformNavigationDelegate_1( this, - Invocation.method( - #createPlatformNavigationDelegate, - [params], - ), + Invocation.method(#createPlatformNavigationDelegate, [params]), ), ) as _i3.PlatformNavigationDelegate); @override _i4.PlatformWebViewController createPlatformWebViewController( - _i6.PlatformWebViewControllerCreationParams? params) => + _i6.PlatformWebViewControllerCreationParams? params, + ) => (super.noSuchMethod( - Invocation.method( - #createPlatformWebViewController, - [params], - ), + Invocation.method(#createPlatformWebViewController, [params]), returnValue: _FakePlatformWebViewController_2( this, - Invocation.method( - #createPlatformWebViewController, - [params], - ), + Invocation.method(#createPlatformWebViewController, [params]), ), ) as _i4.PlatformWebViewController); @override _i5.PlatformWebViewWidget createPlatformWebViewWidget( - _i6.PlatformWebViewWidgetCreationParams? params) => + _i6.PlatformWebViewWidgetCreationParams? params, + ) => (super.noSuchMethod( - Invocation.method( - #createPlatformWebViewWidget, - [params], - ), + Invocation.method(#createPlatformWebViewWidget, [params]), returnValue: _FakePlatformWebViewWidget_3( this, - Invocation.method( - #createPlatformWebViewWidget, - [params], - ), + Invocation.method(#createPlatformWebViewWidget, [params]), ), ) as _i5.PlatformWebViewWidget); } @@ -184,12 +144,10 @@ class MockPlatformNavigationDelegate extends _i1.Mock @override _i8.Future setOnNavigationRequest( - _i3.NavigationRequestCallback? onNavigationRequest) => + _i3.NavigationRequestCallback? onNavigationRequest, + ) => (super.noSuchMethod( - Invocation.method( - #setOnNavigationRequest, - [onNavigationRequest], - ), + Invocation.method(#setOnNavigationRequest, [onNavigationRequest]), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -197,10 +155,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock @override _i8.Future setOnPageStarted(_i3.PageEventCallback? onPageStarted) => (super.noSuchMethod( - Invocation.method( - #setOnPageStarted, - [onPageStarted], - ), + Invocation.method(#setOnPageStarted, [onPageStarted]), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -208,10 +163,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock @override _i8.Future setOnPageFinished(_i3.PageEventCallback? onPageFinished) => (super.noSuchMethod( - Invocation.method( - #setOnPageFinished, - [onPageFinished], - ), + Invocation.method(#setOnPageFinished, [onPageFinished]), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -219,10 +171,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock @override _i8.Future setOnHttpError(_i3.HttpResponseErrorCallback? onHttpError) => (super.noSuchMethod( - Invocation.method( - #setOnHttpError, - [onHttpError], - ), + Invocation.method(#setOnHttpError, [onHttpError]), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -230,22 +179,17 @@ class MockPlatformNavigationDelegate extends _i1.Mock @override _i8.Future setOnProgress(_i3.ProgressCallback? onProgress) => (super.noSuchMethod( - Invocation.method( - #setOnProgress, - [onProgress], - ), + Invocation.method(#setOnProgress, [onProgress]), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setOnWebResourceError( - _i3.WebResourceErrorCallback? onWebResourceError) => + _i3.WebResourceErrorCallback? onWebResourceError, + ) => (super.noSuchMethod( - Invocation.method( - #setOnWebResourceError, - [onWebResourceError], - ), + Invocation.method(#setOnWebResourceError, [onWebResourceError]), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -253,22 +197,17 @@ class MockPlatformNavigationDelegate extends _i1.Mock @override _i8.Future setOnUrlChange(_i3.UrlChangeCallback? onUrlChange) => (super.noSuchMethod( - Invocation.method( - #setOnUrlChange, - [onUrlChange], - ), + Invocation.method(#setOnUrlChange, [onUrlChange]), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setOnHttpAuthRequest( - _i3.HttpAuthRequestCallback? onHttpAuthRequest) => + _i3.HttpAuthRequestCallback? onHttpAuthRequest, + ) => (super.noSuchMethod( - Invocation.method( - #setOnHttpAuthRequest, - [onHttpAuthRequest], - ), + Invocation.method(#setOnHttpAuthRequest, [onHttpAuthRequest]), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); diff --git a/packages/webview_flutter/webview_flutter/test/webview_controller_test.dart b/packages/webview_flutter/webview_flutter/test/webview_controller_test.dart index 6cae01a4941..f0310415a85 100644 --- a/packages/webview_flutter/webview_flutter/test/webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter/test/webview_controller_test.dart @@ -492,6 +492,22 @@ void main() { .setOnScrollPositionChange(onScrollPositionChange), ); }); + + test('setOverScrollMode', () async { + final MockPlatformWebViewController mockPlatformWebViewController = + MockPlatformWebViewController(); + + final WebViewController webViewController = WebViewController.fromPlatform( + mockPlatformWebViewController, + ); + + await webViewController.setOverScrollMode(WebViewOverScrollMode.never); + verify( + mockPlatformWebViewController.setOverScrollMode( + WebViewOverScrollMode.never, + ), + ); + }); } class TestPlatformWebViewPermissionRequest diff --git a/packages/webview_flutter/webview_flutter/test/webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/webview_controller_test.mocks.dart index 981e7386ac0..0c4537103a5 100644 --- a/packages/webview_flutter/webview_flutter/test/webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter/test/webview_controller_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.5 from annotations // in webview_flutter/test/webview_controller_test.dart. // Do not manually edit this file. @@ -21,6 +21,7 @@ import 'package:webview_flutter_platform_interface/src/types/types.dart' as _i2; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types @@ -31,30 +32,17 @@ class _FakePlatformWebViewControllerCreationParams_0 extends _i1.SmartFake _FakePlatformWebViewControllerCreationParams_0( Object parent, Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + ) : super(parent, parentInvocation); } class _FakeObject_1 extends _i1.SmartFake implements Object { - _FakeObject_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeObject_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeOffset_2 extends _i1.SmartFake implements _i3.Offset { - _FakeOffset_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeOffset_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakePlatformNavigationDelegateCreationParams_3 extends _i1.SmartFake @@ -62,10 +50,7 @@ class _FakePlatformNavigationDelegateCreationParams_3 extends _i1.SmartFake _FakePlatformNavigationDelegateCreationParams_3( Object parent, Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + ) : super(parent, parentInvocation); } /// A class which mocks [PlatformWebViewController]. @@ -88,35 +73,22 @@ class MockPlatformWebViewController extends _i1.Mock @override _i5.Future loadFile(String? absoluteFilePath) => (super.noSuchMethod( - Invocation.method( - #loadFile, - [absoluteFilePath], - ), + Invocation.method(#loadFile, [absoluteFilePath]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future loadFlutterAsset(String? key) => (super.noSuchMethod( - Invocation.method( - #loadFlutterAsset, - [key], - ), + Invocation.method(#loadFlutterAsset, [key]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override - _i5.Future loadHtmlString( - String? html, { - String? baseUrl, - }) => + _i5.Future loadHtmlString(String? html, {String? baseUrl}) => (super.noSuchMethod( - Invocation.method( - #loadHtmlString, - [html], - {#baseUrl: baseUrl}, - ), + Invocation.method(#loadHtmlString, [html], {#baseUrl: baseUrl}), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -124,109 +96,77 @@ class MockPlatformWebViewController extends _i1.Mock @override _i5.Future loadRequest(_i2.LoadRequestParams? params) => (super.noSuchMethod( - Invocation.method( - #loadRequest, - [params], - ), + Invocation.method(#loadRequest, [params]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future currentUrl() => (super.noSuchMethod( - Invocation.method( - #currentUrl, - [], - ), + Invocation.method(#currentUrl, []), returnValue: _i5.Future.value(), ) as _i5.Future); @override _i5.Future canGoBack() => (super.noSuchMethod( - Invocation.method( - #canGoBack, - [], - ), + Invocation.method(#canGoBack, []), returnValue: _i5.Future.value(false), ) as _i5.Future); @override _i5.Future canGoForward() => (super.noSuchMethod( - Invocation.method( - #canGoForward, - [], - ), + Invocation.method(#canGoForward, []), returnValue: _i5.Future.value(false), ) as _i5.Future); @override _i5.Future goBack() => (super.noSuchMethod( - Invocation.method( - #goBack, - [], - ), + Invocation.method(#goBack, []), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future goForward() => (super.noSuchMethod( - Invocation.method( - #goForward, - [], - ), + Invocation.method(#goForward, []), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future reload() => (super.noSuchMethod( - Invocation.method( - #reload, - [], - ), + Invocation.method(#reload, []), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future clearCache() => (super.noSuchMethod( - Invocation.method( - #clearCache, - [], - ), + Invocation.method(#clearCache, []), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future clearLocalStorage() => (super.noSuchMethod( - Invocation.method( - #clearLocalStorage, - [], - ), + Invocation.method(#clearLocalStorage, []), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setPlatformNavigationDelegate( - _i6.PlatformNavigationDelegate? handler) => + _i6.PlatformNavigationDelegate? handler, + ) => (super.noSuchMethod( - Invocation.method( - #setPlatformNavigationDelegate, - [handler], - ), + Invocation.method(#setPlatformNavigationDelegate, [handler]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future runJavaScript(String? javaScript) => (super.noSuchMethod( - Invocation.method( - #runJavaScript, - [javaScript], - ), + Invocation.method(#runJavaScript, [javaScript]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -234,27 +174,21 @@ class MockPlatformWebViewController extends _i1.Mock @override _i5.Future runJavaScriptReturningResult(String? javaScript) => (super.noSuchMethod( - Invocation.method( - #runJavaScriptReturningResult, - [javaScript], - ), - returnValue: _i5.Future.value(_FakeObject_1( - this, - Invocation.method( - #runJavaScriptReturningResult, - [javaScript], + Invocation.method(#runJavaScriptReturningResult, [javaScript]), + returnValue: _i5.Future.value( + _FakeObject_1( + this, + Invocation.method(#runJavaScriptReturningResult, [javaScript]), ), - )), + ), ) as _i5.Future); @override _i5.Future addJavaScriptChannel( - _i4.JavaScriptChannelParams? javaScriptChannelParams) => + _i4.JavaScriptChannelParams? javaScriptChannelParams, + ) => (super.noSuchMethod( - Invocation.method( - #addJavaScriptChannel, - [javaScriptChannelParams], - ), + Invocation.method(#addJavaScriptChannel, [javaScriptChannelParams]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -262,88 +196,51 @@ class MockPlatformWebViewController extends _i1.Mock @override _i5.Future removeJavaScriptChannel(String? javaScriptChannelName) => (super.noSuchMethod( - Invocation.method( - #removeJavaScriptChannel, - [javaScriptChannelName], - ), + Invocation.method(#removeJavaScriptChannel, [ + javaScriptChannelName, + ]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future getTitle() => (super.noSuchMethod( - Invocation.method( - #getTitle, - [], - ), + Invocation.method(#getTitle, []), returnValue: _i5.Future.value(), ) as _i5.Future); @override - _i5.Future scrollTo( - int? x, - int? y, - ) => - (super.noSuchMethod( - Invocation.method( - #scrollTo, - [ - x, - y, - ], - ), + _i5.Future scrollTo(int? x, int? y) => (super.noSuchMethod( + Invocation.method(#scrollTo, [x, y]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override - _i5.Future scrollBy( - int? x, - int? y, - ) => - (super.noSuchMethod( - Invocation.method( - #scrollBy, - [ - x, - y, - ], - ), + _i5.Future scrollBy(int? x, int? y) => (super.noSuchMethod( + Invocation.method(#scrollBy, [x, y]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future<_i3.Offset> getScrollPosition() => (super.noSuchMethod( - Invocation.method( - #getScrollPosition, - [], + Invocation.method(#getScrollPosition, []), + returnValue: _i5.Future<_i3.Offset>.value( + _FakeOffset_2(this, Invocation.method(#getScrollPosition, [])), ), - returnValue: _i5.Future<_i3.Offset>.value(_FakeOffset_2( - this, - Invocation.method( - #getScrollPosition, - [], - ), - )), ) as _i5.Future<_i3.Offset>); @override _i5.Future enableZoom(bool? enabled) => (super.noSuchMethod( - Invocation.method( - #enableZoom, - [enabled], - ), + Invocation.method(#enableZoom, [enabled]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setBackgroundColor(_i3.Color? color) => (super.noSuchMethod( - Invocation.method( - #setBackgroundColor, - [color], - ), + Invocation.method(#setBackgroundColor, [color]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -351,105 +248,101 @@ class MockPlatformWebViewController extends _i1.Mock @override _i5.Future setJavaScriptMode(_i2.JavaScriptMode? javaScriptMode) => (super.noSuchMethod( - Invocation.method( - #setJavaScriptMode, - [javaScriptMode], - ), + Invocation.method(#setJavaScriptMode, [javaScriptMode]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setUserAgent(String? userAgent) => (super.noSuchMethod( - Invocation.method( - #setUserAgent, - [userAgent], - ), + Invocation.method(#setUserAgent, [userAgent]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setOnPlatformPermissionRequest( - void Function(_i2.PlatformWebViewPermissionRequest)? - onPermissionRequest) => + void Function(_i2.PlatformWebViewPermissionRequest)? onPermissionRequest, + ) => (super.noSuchMethod( - Invocation.method( - #setOnPlatformPermissionRequest, - [onPermissionRequest], - ), + Invocation.method(#setOnPlatformPermissionRequest, [ + onPermissionRequest, + ]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future getUserAgent() => (super.noSuchMethod( - Invocation.method( - #getUserAgent, - [], - ), + Invocation.method(#getUserAgent, []), returnValue: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setOnConsoleMessage( - void Function(_i2.JavaScriptConsoleMessage)? onConsoleMessage) => + void Function(_i2.JavaScriptConsoleMessage)? onConsoleMessage, + ) => (super.noSuchMethod( - Invocation.method( - #setOnConsoleMessage, - [onConsoleMessage], - ), + Invocation.method(#setOnConsoleMessage, [onConsoleMessage]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setOnScrollPositionChange( - void Function(_i2.ScrollPositionChange)? onScrollPositionChange) => + void Function(_i2.ScrollPositionChange)? onScrollPositionChange, + ) => (super.noSuchMethod( - Invocation.method( - #setOnScrollPositionChange, - [onScrollPositionChange], - ), + Invocation.method(#setOnScrollPositionChange, [ + onScrollPositionChange, + ]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setOnJavaScriptAlertDialog( - _i5.Future Function(_i2.JavaScriptAlertDialogRequest)? - onJavaScriptAlertDialog) => + _i5.Future Function(_i2.JavaScriptAlertDialogRequest)? + onJavaScriptAlertDialog, + ) => (super.noSuchMethod( - Invocation.method( - #setOnJavaScriptAlertDialog, - [onJavaScriptAlertDialog], - ), + Invocation.method(#setOnJavaScriptAlertDialog, [ + onJavaScriptAlertDialog, + ]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setOnJavaScriptConfirmDialog( - _i5.Future Function(_i2.JavaScriptConfirmDialogRequest)? - onJavaScriptConfirmDialog) => + _i5.Future Function(_i2.JavaScriptConfirmDialogRequest)? + onJavaScriptConfirmDialog, + ) => (super.noSuchMethod( - Invocation.method( - #setOnJavaScriptConfirmDialog, - [onJavaScriptConfirmDialog], - ), + Invocation.method(#setOnJavaScriptConfirmDialog, [ + onJavaScriptConfirmDialog, + ]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setOnJavaScriptTextInputDialog( - _i5.Future Function(_i2.JavaScriptTextInputDialogRequest)? - onJavaScriptTextInputDialog) => + _i5.Future Function(_i2.JavaScriptTextInputDialogRequest)? + onJavaScriptTextInputDialog, + ) => (super.noSuchMethod( - Invocation.method( - #setOnJavaScriptTextInputDialog, - [onJavaScriptTextInputDialog], - ), + Invocation.method(#setOnJavaScriptTextInputDialog, [ + onJavaScriptTextInputDialog, + ]), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future setOverScrollMode(_i2.WebViewOverScrollMode? mode) => + (super.noSuchMethod( + Invocation.method(#setOverScrollMode, [mode]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -476,12 +369,10 @@ class MockPlatformNavigationDelegate extends _i1.Mock @override _i5.Future setOnNavigationRequest( - _i6.NavigationRequestCallback? onNavigationRequest) => + _i6.NavigationRequestCallback? onNavigationRequest, + ) => (super.noSuchMethod( - Invocation.method( - #setOnNavigationRequest, - [onNavigationRequest], - ), + Invocation.method(#setOnNavigationRequest, [onNavigationRequest]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -489,10 +380,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock @override _i5.Future setOnPageStarted(_i6.PageEventCallback? onPageStarted) => (super.noSuchMethod( - Invocation.method( - #setOnPageStarted, - [onPageStarted], - ), + Invocation.method(#setOnPageStarted, [onPageStarted]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -500,10 +388,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock @override _i5.Future setOnPageFinished(_i6.PageEventCallback? onPageFinished) => (super.noSuchMethod( - Invocation.method( - #setOnPageFinished, - [onPageFinished], - ), + Invocation.method(#setOnPageFinished, [onPageFinished]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -511,10 +396,7 @@ class MockPlatformNavigationDelegate extends _i1.Mock @override _i5.Future setOnHttpError(_i6.HttpResponseErrorCallback? onHttpError) => (super.noSuchMethod( - Invocation.method( - #setOnHttpError, - [onHttpError], - ), + Invocation.method(#setOnHttpError, [onHttpError]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -522,22 +404,17 @@ class MockPlatformNavigationDelegate extends _i1.Mock @override _i5.Future setOnProgress(_i6.ProgressCallback? onProgress) => (super.noSuchMethod( - Invocation.method( - #setOnProgress, - [onProgress], - ), + Invocation.method(#setOnProgress, [onProgress]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setOnWebResourceError( - _i6.WebResourceErrorCallback? onWebResourceError) => + _i6.WebResourceErrorCallback? onWebResourceError, + ) => (super.noSuchMethod( - Invocation.method( - #setOnWebResourceError, - [onWebResourceError], - ), + Invocation.method(#setOnWebResourceError, [onWebResourceError]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -545,22 +422,17 @@ class MockPlatformNavigationDelegate extends _i1.Mock @override _i5.Future setOnUrlChange(_i6.UrlChangeCallback? onUrlChange) => (super.noSuchMethod( - Invocation.method( - #setOnUrlChange, - [onUrlChange], - ), + Invocation.method(#setOnUrlChange, [onUrlChange]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setOnHttpAuthRequest( - _i6.HttpAuthRequestCallback? onHttpAuthRequest) => + _i6.HttpAuthRequestCallback? onHttpAuthRequest, + ) => (super.noSuchMethod( - Invocation.method( - #setOnHttpAuthRequest, - [onHttpAuthRequest], - ), + Invocation.method(#setOnHttpAuthRequest, [onHttpAuthRequest]), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); diff --git a/packages/webview_flutter/webview_flutter/test/webview_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/webview_cookie_manager_test.mocks.dart index 20bf87f4dca..31b11889cb7 100644 --- a/packages/webview_flutter/webview_flutter/test/webview_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter/test/webview_cookie_manager_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.5 from annotations // in webview_flutter/test/webview_cookie_manager_test.dart. // Do not manually edit this file. @@ -18,6 +18,7 @@ import 'package:webview_flutter_platform_interface/src/types/types.dart' as _i2; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types @@ -28,10 +29,7 @@ class _FakePlatformWebViewCookieManagerCreationParams_0 extends _i1.SmartFake _FakePlatformWebViewCookieManagerCreationParams_0( Object parent, Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + ) : super(parent, parentInvocation); } /// A class which mocks [PlatformWebViewCookieManager]. @@ -55,19 +53,13 @@ class MockPlatformWebViewCookieManager extends _i1.Mock @override _i4.Future clearCookies() => (super.noSuchMethod( - Invocation.method( - #clearCookies, - [], - ), + Invocation.method(#clearCookies, []), returnValue: _i4.Future.value(false), ) as _i4.Future); @override _i4.Future setCookie(_i2.WebViewCookie? cookie) => (super.noSuchMethod( - Invocation.method( - #setCookie, - [cookie], - ), + Invocation.method(#setCookie, [cookie]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); diff --git a/packages/webview_flutter/webview_flutter/test/webview_flutter_export_test.dart b/packages/webview_flutter/webview_flutter/test/webview_flutter_export_test.dart index 907cc474cc8..b404fce0020 100644 --- a/packages/webview_flutter/webview_flutter/test/webview_flutter_export_test.dart +++ b/packages/webview_flutter/webview_flutter/test/webview_flutter_export_test.dart @@ -30,6 +30,7 @@ void main() { main_file.PlatformWebViewPermissionRequest; main_file.PlatformWebViewWidgetCreationParams; main_file.ProgressCallback; + main_file.WebViewOverScrollMode; main_file.WebViewPermissionResourceType; main_file.WebResourceError; main_file.WebResourceErrorCallback; diff --git a/packages/webview_flutter/webview_flutter/test/webview_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/webview_widget_test.mocks.dart index ec6bd85e095..69e0c449c6d 100644 --- a/packages/webview_flutter/webview_flutter/test/webview_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter/test/webview_widget_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.5 from annotations // in webview_flutter/test/webview_widget_test.dart. // Do not manually edit this file. @@ -25,6 +25,7 @@ import 'package:webview_flutter_platform_interface/src/types/types.dart' as _i2; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types @@ -35,30 +36,17 @@ class _FakePlatformWebViewControllerCreationParams_0 extends _i1.SmartFake _FakePlatformWebViewControllerCreationParams_0( Object parent, Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + ) : super(parent, parentInvocation); } class _FakeObject_1 extends _i1.SmartFake implements Object { - _FakeObject_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeObject_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeOffset_2 extends _i1.SmartFake implements _i3.Offset { - _FakeOffset_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeOffset_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakePlatformWebViewWidgetCreationParams_3 extends _i1.SmartFake @@ -66,20 +54,12 @@ class _FakePlatformWebViewWidgetCreationParams_3 extends _i1.SmartFake _FakePlatformWebViewWidgetCreationParams_3( Object parent, Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + ) : super(parent, parentInvocation); } class _FakeWidget_4 extends _i1.SmartFake implements _i4.Widget { - _FakeWidget_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWidget_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); @override String toString({_i5.DiagnosticLevel? minLevel = _i5.DiagnosticLevel.info}) => @@ -106,35 +86,22 @@ class MockPlatformWebViewController extends _i1.Mock @override _i7.Future loadFile(String? absoluteFilePath) => (super.noSuchMethod( - Invocation.method( - #loadFile, - [absoluteFilePath], - ), + Invocation.method(#loadFile, [absoluteFilePath]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future loadFlutterAsset(String? key) => (super.noSuchMethod( - Invocation.method( - #loadFlutterAsset, - [key], - ), + Invocation.method(#loadFlutterAsset, [key]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - _i7.Future loadHtmlString( - String? html, { - String? baseUrl, - }) => + _i7.Future loadHtmlString(String? html, {String? baseUrl}) => (super.noSuchMethod( - Invocation.method( - #loadHtmlString, - [html], - {#baseUrl: baseUrl}, - ), + Invocation.method(#loadHtmlString, [html], {#baseUrl: baseUrl}), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @@ -142,109 +109,77 @@ class MockPlatformWebViewController extends _i1.Mock @override _i7.Future loadRequest(_i2.LoadRequestParams? params) => (super.noSuchMethod( - Invocation.method( - #loadRequest, - [params], - ), + Invocation.method(#loadRequest, [params]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future currentUrl() => (super.noSuchMethod( - Invocation.method( - #currentUrl, - [], - ), + Invocation.method(#currentUrl, []), returnValue: _i7.Future.value(), ) as _i7.Future); @override _i7.Future canGoBack() => (super.noSuchMethod( - Invocation.method( - #canGoBack, - [], - ), + Invocation.method(#canGoBack, []), returnValue: _i7.Future.value(false), ) as _i7.Future); @override _i7.Future canGoForward() => (super.noSuchMethod( - Invocation.method( - #canGoForward, - [], - ), + Invocation.method(#canGoForward, []), returnValue: _i7.Future.value(false), ) as _i7.Future); @override _i7.Future goBack() => (super.noSuchMethod( - Invocation.method( - #goBack, - [], - ), + Invocation.method(#goBack, []), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future goForward() => (super.noSuchMethod( - Invocation.method( - #goForward, - [], - ), + Invocation.method(#goForward, []), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future reload() => (super.noSuchMethod( - Invocation.method( - #reload, - [], - ), + Invocation.method(#reload, []), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future clearCache() => (super.noSuchMethod( - Invocation.method( - #clearCache, - [], - ), + Invocation.method(#clearCache, []), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future clearLocalStorage() => (super.noSuchMethod( - Invocation.method( - #clearLocalStorage, - [], - ), + Invocation.method(#clearLocalStorage, []), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future setPlatformNavigationDelegate( - _i8.PlatformNavigationDelegate? handler) => + _i8.PlatformNavigationDelegate? handler, + ) => (super.noSuchMethod( - Invocation.method( - #setPlatformNavigationDelegate, - [handler], - ), + Invocation.method(#setPlatformNavigationDelegate, [handler]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future runJavaScript(String? javaScript) => (super.noSuchMethod( - Invocation.method( - #runJavaScript, - [javaScript], - ), + Invocation.method(#runJavaScript, [javaScript]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @@ -252,27 +187,21 @@ class MockPlatformWebViewController extends _i1.Mock @override _i7.Future runJavaScriptReturningResult(String? javaScript) => (super.noSuchMethod( - Invocation.method( - #runJavaScriptReturningResult, - [javaScript], - ), - returnValue: _i7.Future.value(_FakeObject_1( - this, - Invocation.method( - #runJavaScriptReturningResult, - [javaScript], + Invocation.method(#runJavaScriptReturningResult, [javaScript]), + returnValue: _i7.Future.value( + _FakeObject_1( + this, + Invocation.method(#runJavaScriptReturningResult, [javaScript]), ), - )), + ), ) as _i7.Future); @override _i7.Future addJavaScriptChannel( - _i6.JavaScriptChannelParams? javaScriptChannelParams) => + _i6.JavaScriptChannelParams? javaScriptChannelParams, + ) => (super.noSuchMethod( - Invocation.method( - #addJavaScriptChannel, - [javaScriptChannelParams], - ), + Invocation.method(#addJavaScriptChannel, [javaScriptChannelParams]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @@ -280,88 +209,51 @@ class MockPlatformWebViewController extends _i1.Mock @override _i7.Future removeJavaScriptChannel(String? javaScriptChannelName) => (super.noSuchMethod( - Invocation.method( - #removeJavaScriptChannel, - [javaScriptChannelName], - ), + Invocation.method(#removeJavaScriptChannel, [ + javaScriptChannelName, + ]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future getTitle() => (super.noSuchMethod( - Invocation.method( - #getTitle, - [], - ), + Invocation.method(#getTitle, []), returnValue: _i7.Future.value(), ) as _i7.Future); @override - _i7.Future scrollTo( - int? x, - int? y, - ) => - (super.noSuchMethod( - Invocation.method( - #scrollTo, - [ - x, - y, - ], - ), + _i7.Future scrollTo(int? x, int? y) => (super.noSuchMethod( + Invocation.method(#scrollTo, [x, y]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - _i7.Future scrollBy( - int? x, - int? y, - ) => - (super.noSuchMethod( - Invocation.method( - #scrollBy, - [ - x, - y, - ], - ), + _i7.Future scrollBy(int? x, int? y) => (super.noSuchMethod( + Invocation.method(#scrollBy, [x, y]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future<_i3.Offset> getScrollPosition() => (super.noSuchMethod( - Invocation.method( - #getScrollPosition, - [], + Invocation.method(#getScrollPosition, []), + returnValue: _i7.Future<_i3.Offset>.value( + _FakeOffset_2(this, Invocation.method(#getScrollPosition, [])), ), - returnValue: _i7.Future<_i3.Offset>.value(_FakeOffset_2( - this, - Invocation.method( - #getScrollPosition, - [], - ), - )), ) as _i7.Future<_i3.Offset>); @override _i7.Future enableZoom(bool? enabled) => (super.noSuchMethod( - Invocation.method( - #enableZoom, - [enabled], - ), + Invocation.method(#enableZoom, [enabled]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future setBackgroundColor(_i3.Color? color) => (super.noSuchMethod( - Invocation.method( - #setBackgroundColor, - [color], - ), + Invocation.method(#setBackgroundColor, [color]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @@ -369,105 +261,101 @@ class MockPlatformWebViewController extends _i1.Mock @override _i7.Future setJavaScriptMode(_i2.JavaScriptMode? javaScriptMode) => (super.noSuchMethod( - Invocation.method( - #setJavaScriptMode, - [javaScriptMode], - ), + Invocation.method(#setJavaScriptMode, [javaScriptMode]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future setUserAgent(String? userAgent) => (super.noSuchMethod( - Invocation.method( - #setUserAgent, - [userAgent], - ), + Invocation.method(#setUserAgent, [userAgent]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future setOnPlatformPermissionRequest( - void Function(_i2.PlatformWebViewPermissionRequest)? - onPermissionRequest) => + void Function(_i2.PlatformWebViewPermissionRequest)? onPermissionRequest, + ) => (super.noSuchMethod( - Invocation.method( - #setOnPlatformPermissionRequest, - [onPermissionRequest], - ), + Invocation.method(#setOnPlatformPermissionRequest, [ + onPermissionRequest, + ]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future getUserAgent() => (super.noSuchMethod( - Invocation.method( - #getUserAgent, - [], - ), + Invocation.method(#getUserAgent, []), returnValue: _i7.Future.value(), ) as _i7.Future); @override _i7.Future setOnConsoleMessage( - void Function(_i2.JavaScriptConsoleMessage)? onConsoleMessage) => + void Function(_i2.JavaScriptConsoleMessage)? onConsoleMessage, + ) => (super.noSuchMethod( - Invocation.method( - #setOnConsoleMessage, - [onConsoleMessage], - ), + Invocation.method(#setOnConsoleMessage, [onConsoleMessage]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future setOnScrollPositionChange( - void Function(_i2.ScrollPositionChange)? onScrollPositionChange) => + void Function(_i2.ScrollPositionChange)? onScrollPositionChange, + ) => (super.noSuchMethod( - Invocation.method( - #setOnScrollPositionChange, - [onScrollPositionChange], - ), + Invocation.method(#setOnScrollPositionChange, [ + onScrollPositionChange, + ]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future setOnJavaScriptAlertDialog( - _i7.Future Function(_i2.JavaScriptAlertDialogRequest)? - onJavaScriptAlertDialog) => + _i7.Future Function(_i2.JavaScriptAlertDialogRequest)? + onJavaScriptAlertDialog, + ) => (super.noSuchMethod( - Invocation.method( - #setOnJavaScriptAlertDialog, - [onJavaScriptAlertDialog], - ), + Invocation.method(#setOnJavaScriptAlertDialog, [ + onJavaScriptAlertDialog, + ]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future setOnJavaScriptConfirmDialog( - _i7.Future Function(_i2.JavaScriptConfirmDialogRequest)? - onJavaScriptConfirmDialog) => + _i7.Future Function(_i2.JavaScriptConfirmDialogRequest)? + onJavaScriptConfirmDialog, + ) => (super.noSuchMethod( - Invocation.method( - #setOnJavaScriptConfirmDialog, - [onJavaScriptConfirmDialog], - ), + Invocation.method(#setOnJavaScriptConfirmDialog, [ + onJavaScriptConfirmDialog, + ]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override _i7.Future setOnJavaScriptTextInputDialog( - _i7.Future Function(_i2.JavaScriptTextInputDialogRequest)? - onJavaScriptTextInputDialog) => + _i7.Future Function(_i2.JavaScriptTextInputDialogRequest)? + onJavaScriptTextInputDialog, + ) => (super.noSuchMethod( - Invocation.method( - #setOnJavaScriptTextInputDialog, - [onJavaScriptTextInputDialog], - ), + Invocation.method(#setOnJavaScriptTextInputDialog, [ + onJavaScriptTextInputDialog, + ]), + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); + + @override + _i7.Future setOverScrollMode(_i2.WebViewOverScrollMode? mode) => + (super.noSuchMethod( + Invocation.method(#setOverScrollMode, [mode]), returnValue: _i7.Future.value(), returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @@ -493,16 +381,10 @@ class MockPlatformWebViewWidget extends _i1.Mock @override _i4.Widget build(_i4.BuildContext? context) => (super.noSuchMethod( - Invocation.method( - #build, - [context], - ), + Invocation.method(#build, [context]), returnValue: _FakeWidget_4( this, - Invocation.method( - #build, - [context], - ), + Invocation.method(#build, [context]), ), ) as _i4.Widget); } diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md index 4b90957df14..f82c8287541 100644 --- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md @@ -1,3 +1,11 @@ +## 4.4.1 + +* Removes obsolete code related to supporting SDK <21. + +## 4.4.0 + +* Adds support to set the over-scroll mode for the WebView. See `AndroidWebViewController.setOverScrollMode`. + ## 4.3.5 * Adds internal wrapper methods for native `WebViewClient`. diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt index a347b77fa97..fdbbd259af3 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt @@ -642,6 +642,7 @@ private class AndroidWebkitLibraryPigeonProxyApiBaseCodec( value is String || value is FileChooserMode || value is ConsoleMessageLevel || + value is OverScrollMode || value is SslErrorType || value == null) { super.writeValue(stream, value) @@ -814,6 +815,31 @@ enum class ConsoleMessageLevel(val raw: Int) { } } +/** + * The over-scroll mode for a view. + * + * See https://developer.android.com/reference/android/view/View#OVER_SCROLL_ALWAYS. + */ +enum class OverScrollMode(val raw: Int) { + /** Always allow a user to over-scroll this view, provided it is a view that can scroll. */ + ALWAYS(0), + /** + * Allow a user to over-scroll this view only if the content is large enough to meaningfully + * scroll, provided it is a view that can scroll. + */ + IF_CONTENT_SCROLLS(1), + /** Never allow a user to over-scroll this view. */ + NEVER(2), + /** The type is not recognized by this wrapper. */ + UNKNOWN(3); + + companion object { + fun ofRaw(raw: Int): OverScrollMode? { + return values().firstOrNull { it.raw == raw } + } + } +} + /** * Type of error for a SslCertificate. * @@ -852,6 +878,9 @@ private open class AndroidWebkitLibraryPigeonCodec : StandardMessageCodec() { return (readValue(buffer) as Long?)?.let { ConsoleMessageLevel.ofRaw(it.toInt()) } } 131.toByte() -> { + return (readValue(buffer) as Long?)?.let { OverScrollMode.ofRaw(it.toInt()) } + } + 132.toByte() -> { return (readValue(buffer) as Long?)?.let { SslErrorType.ofRaw(it.toInt()) } } else -> super.readValueOfType(type, buffer) @@ -868,10 +897,14 @@ private open class AndroidWebkitLibraryPigeonCodec : StandardMessageCodec() { stream.write(130) writeValue(stream, value.raw) } - is SslErrorType -> { + is OverScrollMode -> { stream.write(131) writeValue(stream, value.raw) } + is SslErrorType -> { + stream.write(132) + writeValue(stream, value.raw) + } else -> super.writeValue(stream, value) } } @@ -4780,6 +4813,9 @@ abstract class PigeonApiView( /** Return the scrolled position of this view. */ abstract fun getScrollPosition(pigeon_instance: android.view.View): WebViewPoint + /** Set the over-scroll mode for this view. */ + abstract fun setOverScrollMode(pigeon_instance: android.view.View, mode: OverScrollMode) + companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiView?) { @@ -4852,6 +4888,30 @@ abstract class PigeonApiView( channel.setMessageHandler(null) } } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.View.setOverScrollMode", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val pigeon_instanceArg = args[0] as android.view.View + val modeArg = args[1] as OverScrollMode + val wrapped: List = + try { + api.setOverScrollMode(pigeon_instanceArg, modeArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewProxyApi.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewProxyApi.java index e5efbd15f81..e4925f9912d 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewProxyApi.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewProxyApi.java @@ -19,6 +19,12 @@ public ViewProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { super(pigeonRegistrar); } + @NonNull + @Override + public ProxyApiRegistrar getPigeonRegistrar() { + return (ProxyApiRegistrar) super.getPigeonRegistrar(); + } + @Override public void scrollTo(@NonNull View pigeon_instance, long x, long y) { pigeon_instance.scrollTo((int) x, (int) y); @@ -34,4 +40,21 @@ public void scrollBy(@NonNull View pigeon_instance, long x, long y) { public WebViewPoint getScrollPosition(@NonNull View pigeon_instance) { return new WebViewPoint(pigeon_instance.getScrollX(), pigeon_instance.getScrollY()); } + + @Override + public void setOverScrollMode(@NonNull View pigeon_instance, @NonNull OverScrollMode mode) { + switch (mode) { + case ALWAYS: + pigeon_instance.setOverScrollMode(View.OVER_SCROLL_ALWAYS); + break; + case IF_CONTENT_SCROLLS: + pigeon_instance.setOverScrollMode(View.OVER_SCROLL_IF_CONTENT_SCROLLS); + break; + case NEVER: + pigeon_instance.setOverScrollMode(View.OVER_SCROLL_NEVER); + break; + case UNKNOWN: + throw getPigeonRegistrar().createUnknownEnumException(OverScrollMode.UNKNOWN); + } + } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java index 2ae41983d44..4f806e5812d 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java @@ -49,4 +49,15 @@ public void getScrollPosition() { assertEquals(value.getX(), api.getScrollPosition(instance).getX()); assertEquals(value.getY(), api.getScrollPosition(instance).getY()); } + + @Test + public void setOverScrollMode() { + final PigeonApiView api = new TestProxyApiRegistrar().getPigeonApiView(); + + final View instance = mock(View.class); + final OverScrollMode mode = io.flutter.plugins.webviewflutter.OverScrollMode.ALWAYS; + api.setOverScrollMode(instance, mode); + + verify(instance).setOverScrollMode(View.OVER_SCROLL_ALWAYS); + } } diff --git a/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml index c22d7dc7022..de6c69e7806 100644 --- a/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - webview_flutter_platform_interface: ^2.10.0 + webview_flutter_platform_interface: ^2.11.0 dev_dependencies: espresso: ^0.4.0 diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart index f67bae562ad..fe377e68926 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart @@ -521,6 +521,25 @@ enum ConsoleMessageLevel { unknown, } +/// The over-scroll mode for a view. +/// +/// See https://developer.android.com/reference/android/view/View#OVER_SCROLL_ALWAYS. +enum OverScrollMode { + /// Always allow a user to over-scroll this view, provided it is a view that + /// can scroll. + always, + + /// Allow a user to over-scroll this view only if the content is large enough + /// to meaningfully scroll, provided it is a view that can scroll. + ifContentScrolls, + + /// Never allow a user to over-scroll this view. + never, + + /// The type is not recognized by this wrapper. + unknown, +} + /// Type of error for a SslCertificate. /// /// See https://developer.android.com/reference/android/net/http/SslError#SSL_DATE_INVALID. @@ -560,9 +579,12 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is ConsoleMessageLevel) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is SslErrorType) { + } else if (value is OverScrollMode) { buffer.putUint8(131); writeValue(buffer, value.index); + } else if (value is SslErrorType) { + buffer.putUint8(132); + writeValue(buffer, value.index); } else { super.writeValue(buffer, value); } @@ -578,6 +600,9 @@ class _PigeonCodec extends StandardMessageCodec { final int? value = readValue(buffer) as int?; return value == null ? null : ConsoleMessageLevel.values[value]; case 131: + final int? value = readValue(buffer) as int?; + return value == null ? null : OverScrollMode.values[value]; + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : SslErrorType.values[value]; default: @@ -6586,6 +6611,36 @@ class View extends PigeonInternalProxyApiBaseClass { } } + /// Set the over-scroll mode for this view. + Future setOverScrollMode(OverScrollMode mode) async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecView; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.webview_flutter_android.View.setOverScrollMode'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, mode]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + @override View pigeon_copy() { return View.pigeon_detached( diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index 7317affbd85..c8326529e59 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -731,6 +731,24 @@ class AndroidWebViewController extends PlatformWebViewController { _onJavaScriptPrompt = onJavaScriptTextInputDialog; return _webChromeClient.setSynchronousReturnValueForOnJsPrompt(true); } + + @override + Future setOverScrollMode(WebViewOverScrollMode mode) { + return switch (mode) { + WebViewOverScrollMode.always => _webView.setOverScrollMode( + android_webview.OverScrollMode.always, + ), + WebViewOverScrollMode.ifContentScrolls => _webView.setOverScrollMode( + android_webview.OverScrollMode.ifContentScrolls, + ), + WebViewOverScrollMode.never => _webView.setOverScrollMode( + android_webview.OverScrollMode.never, + ), + // This prevents future additions from causing a breaking change. + // ignore: unreachable_switch_case + _ => throw UnsupportedError('Android does not support $mode.'), + }; + } } /// Android implementation of [PlatformWebViewPermissionRequest]. diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_cookie_manager.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_cookie_manager.dart index ae199327a85..4c8db3e16e3 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_cookie_manager.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_cookie_manager.dart @@ -75,9 +75,7 @@ class AndroidWebViewCookieManager extends PlatformWebViewCookieManager { /// Sets whether the WebView should allow third party cookies to be set. /// - /// Apps that target `Build.VERSION_CODES.KITKAT` or below default to allowing - /// third party cookies. Apps targeting `Build.VERSION_CODES.LOLLIPOP` or - /// later default to disallowing third party cookies. + /// Defaults to false. Future setAcceptThirdPartyCookies( AndroidWebViewController controller, bool accept, diff --git a/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart b/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart index cc173f8f875..42a15fc68bd 100644 --- a/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart +++ b/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart @@ -80,6 +80,25 @@ enum ConsoleMessageLevel { unknown, } +/// The over-scroll mode for a view. +/// +/// See https://developer.android.com/reference/android/view/View#OVER_SCROLL_ALWAYS. +enum OverScrollMode { + /// Always allow a user to over-scroll this view, provided it is a view that + /// can scroll. + always, + + /// Allow a user to over-scroll this view only if the content is large enough + /// to meaningfully scroll, provided it is a view that can scroll. + ifContentScrolls, + + /// Never allow a user to over-scroll this view. + never, + + /// The type is not recognized by this wrapper. + unknown, +} + /// Type of error for a SslCertificate. /// /// See https://developer.android.com/reference/android/net/http/SslError#SSL_DATE_INVALID. @@ -832,6 +851,9 @@ abstract class View { /// Return the scrolled position of this view. WebViewPoint getScrollPosition(); + + /// Set the over-scroll mode for this view. + void setOverScrollMode(OverScrollMode mode); } /// A callback interface used by the host application to set the Geolocation diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 915ac70f768..39bb1c63dda 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_android description: A Flutter plugin that provides a WebView widget on Android. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 4.3.5 +version: 4.4.1 environment: sdk: ^3.6.0 @@ -20,14 +20,14 @@ flutter: dependencies: flutter: sdk: flutter - webview_flutter_platform_interface: ^2.10.0 + webview_flutter_platform_interface: ^2.11.0 dev_dependencies: build_runner: ^2.1.4 flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^25.2.0 + pigeon: ^25.3.0 topics: - html diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart index 4fd19cf68a8..87bab7f8f5d 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart @@ -1624,6 +1624,21 @@ void main() { verify(mockSettings.setTextZoom(100)).called(1); }); + test('setOverScrollMode', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.setOverScrollMode(WebViewOverScrollMode.always); + + verify( + mockWebView.setOverScrollMode( + android_webview.OverScrollMode.always, + ), + ).called(1); + }); + test('webViewIdentifier', () { final MockWebView mockWebView = MockWebView(); diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart index 02bcae66842..10247006657 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart @@ -688,6 +688,14 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + + @override + _i8.Future setOverScrollMode(_i3.WebViewOverScrollMode? mode) => + (super.noSuchMethod( + Invocation.method(#setOverScrollMode, [mode]), + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); } /// A class which mocks [AndroidWebViewProxy]. @@ -2476,6 +2484,14 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), ), ) as _i8.Future<_i2.WebViewPoint>); + + @override + _i8.Future setOverScrollMode(_i2.OverScrollMode? mode) => + (super.noSuchMethod( + Invocation.method(#setOverScrollMode, [mode]), + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); } /// A class which mocks [WebViewClient]. diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart index 8d6b892fcfc..b44e59a8c08 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart @@ -472,4 +472,12 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + + @override + _i5.Future setOverScrollMode(_i3.WebViewOverScrollMode? mode) => + (super.noSuchMethod( + Invocation.method(#setOverScrollMode, [mode]), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); } diff --git a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart index b7d9898b9c0..6eebf3a56d8 100644 --- a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart @@ -546,6 +546,14 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), ), ) as _i4.Future<_i2.WebViewPoint>); + + @override + _i4.Future setOverScrollMode(_i2.OverScrollMode? mode) => + (super.noSuchMethod( + Invocation.method(#setOverScrollMode, [mode]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } /// A class which mocks [WebResourceRequest]. diff --git a/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md b/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md index 5b3a1ba25b3..6f452d22a1b 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 2.11.0 +* Adds support to set the over-scroll mode for the WebView. See `PlatformWebViewController.setOverScrollMode`. * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 2.10.0 diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_webview_controller.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_webview_controller.dart index 2aaabb519cc..34b68a02dfc 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_webview_controller.dart @@ -324,6 +324,13 @@ abstract class PlatformWebViewController extends PlatformInterface { 'setOnJavaScriptTextInputDialog is not implemented on the current platform', ); } + + /// Sets the over-scroll mode for the WebView. + Future setOverScrollMode(WebViewOverScrollMode mode) async { + throw UnimplementedError( + 'setOverScrollMode is not implemented on the current platform', + ); + } } /// Describes the parameters necessary for registering a JavaScript channel. diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/over_scroll_mode.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/over_scroll_mode.dart new file mode 100644 index 00000000000..b2622abe817 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/over_scroll_mode.dart @@ -0,0 +1,16 @@ +// 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. + +/// Defines the over-scroll behavior of a WebView. +enum WebViewOverScrollMode { + /// Always allow a user to over-scroll the WebView. + always, + + /// Allow a user to over-scroll the WebView only if the content is larger than + /// the viewport. + ifContentScrolls, + + /// Never allow a user to over-scroll the WebView. + never, +} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart index ec6c0bc2c47..937b44a13a8 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart @@ -12,6 +12,7 @@ export 'javascript_mode.dart'; export 'load_request_params.dart'; export 'navigation_decision.dart'; export 'navigation_request.dart'; +export 'over_scroll_mode.dart'; export 'platform_navigation_delegate_creation_params.dart'; export 'platform_webview_controller_creation_params.dart'; export 'platform_webview_cookie_manager_creation_params.dart'; diff --git a/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml b/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml index 6bfcad34aa5..cdac767ba8e 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/webview_flutt issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview_flutter%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.10.0 +version: 2.11.0 environment: sdk: ^3.4.0 diff --git a/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.dart index db3cf1dd5d6..7ef8343b0d4 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/test/platform_webview_controller_test.dart @@ -457,6 +457,19 @@ void main() { throwsUnimplementedError, ); }); + + test( + 'Default implementation of setOverScrollMode should throw unimplemented error', + () { + final PlatformWebViewController controller = + ExtendsPlatformWebViewController( + const PlatformWebViewControllerCreationParams()); + + expect( + () => controller.setOverScrollMode(WebViewOverScrollMode.always), + throwsUnimplementedError, + ); + }); } class MockWebViewPlatformWithMixin extends MockWebViewPlatform diff --git a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md index 11dbc2c5a86..2723c74a094 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md @@ -1,3 +1,12 @@ +## 3.20.0 + +* Adds support to disable a preview of the destination for a link. See + `WebKitWebViewController.setAllowsLinkPreview`. + +## 3.19.0 + +* Adds support to set the over-scroll mode for the WebView. See `WebKitWebViewController.setOverScrollMode`. + ## 3.18.6 * Fixes `PlatformException` when calling `loadFlutterAsset` on macOS. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/WebViewProxyAPITests.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/WebViewProxyAPITests.swift index b2e0ae0f081..8decb87c023 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/WebViewProxyAPITests.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/WebViewProxyAPITests.swift @@ -278,6 +278,18 @@ class WebViewProxyAPITests: XCTestCase { XCTAssertFalse(instance.isInspectable) } + @MainActor func testSetAllowsLinkPreview() { + let registrar = TestProxyApiRegistrar() + let api = webViewProxyAPI(forRegistrar: registrar) + + let instance = TestViewWKWebView() + let allow: Bool = true + try? api.pigeonDelegate.setAllowsLinkPreview( + pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.allowsLinkPreview, allow) + } + @MainActor func testGetCustomUserAgent() { let registrar = TestProxyApiRegistrar() let api = webViewProxyAPI(forRegistrar: registrar) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebKitLibrary.g.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebKitLibrary.g.swift index 9d35176ec17..d99e60eb5d5 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebKitLibrary.g.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebKitLibrary.g.swift @@ -1,7 +1,7 @@ // 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 (v25.2.0), do not edit directly. +// Autogenerated from Pigeon (v25.3.0), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -77,6 +77,7 @@ private func nilOrValue(_ value: Any?) -> T? { if value is NSNull { return nil } return value as! T? } + /// Handles the callback when an object is deallocated. protocol WebKitLibraryPigeonInternalFinalizerDelegate: AnyObject { /// Invoked when the strong reference of an object is deallocated in an `InstanceManager`. @@ -4774,6 +4775,14 @@ protocol PigeonApiDelegateUIViewWKWebView { func getCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif + #if !os(macOS) + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// Defaults to true. + func setAllowsLinkPreview( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + #endif } protocol PigeonApiProtocolUIViewWKWebView { @@ -5272,6 +5281,27 @@ final class PigeonApiUIViewWKWebView: PigeonApiProtocolUIViewWKWebView { getCustomUserAgentChannel.setMessageHandler(nil) } #endif + #if !os(macOS) + let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsLinkPreview", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsLinkPreviewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsLinkPreview( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + setAllowsLinkPreviewChannel.setMessageHandler(nil) + } + #endif } #if !os(macOS) @@ -5424,6 +5454,14 @@ protocol PigeonApiDelegateNSViewWKWebView { func getCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif + #if !os(iOS) + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// Defaults to true. + func setAllowsLinkPreview( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + #endif } protocol PigeonApiProtocolNSViewWKWebView { @@ -5900,6 +5938,27 @@ final class PigeonApiNSViewWKWebView: PigeonApiProtocolNSViewWKWebView { getCustomUserAgentChannel.setMessageHandler(nil) } #endif + #if !os(iOS) + let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsLinkPreview", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsLinkPreviewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsLinkPreview( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + setAllowsLinkPreviewChannel.setMessageHandler(nil) + } + #endif } #if !os(iOS) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebViewProxyAPIDelegate.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebViewProxyAPIDelegate.swift index ca46bbb223f..b5b6a1cb7a1 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebViewProxyAPIDelegate.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebViewProxyAPIDelegate.swift @@ -380,4 +380,17 @@ class WebViewProxyAPIDelegate: PigeonApiDelegateWKWebView, PigeonApiDelegateUIVi return try getCustomUserAgent( pigeonApi: getUIViewWKWebViewAPI(pigeonApi), pigeonInstance: pigeonInstance) } + + func setAllowsLinkPreview( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool + ) throws { + pigeonInstance.allowsLinkPreview = allow + } + + func setAllowsLinkPreview( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool + ) throws { + try setAllowsLinkPreview( + pigeonApi: getUIViewWKWebViewAPI(pigeonApi), pigeonInstance: pigeonInstance, allow: allow) + } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml index f8ed12551d5..fa7f2114200 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml @@ -10,7 +10,7 @@ dependencies: flutter: sdk: flutter path_provider: ^2.0.6 - webview_flutter_platform_interface: ^2.10.0 + webview_flutter_platform_interface: ^2.11.0 webview_flutter_wkwebview: # When depending on this package from a real application you should use: # webview_flutter: ^x.y.z diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/platform_webview.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/platform_webview.dart index 7a9638ec099..5ddb5766440 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/platform_webview.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/platform_webview.dart @@ -397,4 +397,20 @@ class PlatformWebView { throw UnimplementedError('${webView.runtimeType} is not supported.'); } + + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// Defaults to true. + Future setAllowsLinkPreview(bool allow) { + final WKWebView webView = nativeWebView; + switch (webView) { + case UIViewWKWebView(): + return webView.setAllowsLinkPreview(allow); + case NSViewWKWebView(): + return webView.setAllowsLinkPreview(allow); + } + + throw UnimplementedError('${webView.runtimeType} is not supported.'); + } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart index c94b4adb44b..5d3f3ee1fe7 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart @@ -1,7 +1,7 @@ // 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 (v25.2.0), do not edit directly. +// Autogenerated from Pigeon (v25.3.0), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -5822,6 +5822,39 @@ class UIViewWKWebView extends UIView implements WKWebView { } } + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// Defaults to true. + Future setAllowsLinkPreview(bool allow) async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecUIViewWKWebView; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsLinkPreview'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, allow]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + @override UIViewWKWebView pigeon_copy() { return UIViewWKWebView.pigeon_detached( @@ -6577,6 +6610,39 @@ class NSViewWKWebView extends NSObject implements WKWebView { } } + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// Defaults to true. + Future setAllowsLinkPreview(bool allow) async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecNSViewWKWebView; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsLinkPreview'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this, allow]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + @override NSViewWKWebView pigeon_copy() { return NSViewWKWebView.pigeon_detached( diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart index 843c73f3de3..57f188e9e71 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart @@ -369,6 +369,39 @@ class WebKitWebViewController extends PlatformWebViewController { int get webViewIdentifier => _webKitParams._instanceManager.getIdentifier(_webView.nativeWebView)!; + /// Whether horizontal swipe gestures trigger page navigation. + Future setAllowsBackForwardNavigationGestures(bool enabled) { + return _webView.setAllowsBackForwardNavigationGestures(enabled); + } + + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// This property is available on devices that support 3D Touch. + /// + /// Defaults to true. + Future setAllowsLinkPreview(bool allow) { + return _webView.setAllowsLinkPreview(allow); + } + + /// Sets the listener for canGoBack changes. + Future setOnCanGoBackChange( + void Function(bool) onCanGoBackChangeCallback) async { + _onCanGoBackChangeCallback = onCanGoBackChangeCallback; + } + + /// Whether to enable tools for debugging the current WKWebView content. + /// + /// It needs to be activated in each WKWebView where you want to enable it. + /// + /// Starting from macOS version 13.3, iOS version 16.4, and tvOS version 16.4, + /// the default value is set to false. + /// + /// Defaults to true in previous versions. + Future setInspectable(bool inspectable) { + return _webView.setInspectable(inspectable); + } + @override Future loadFile(String absoluteFilePath) { return _webView.loadFileUrl( @@ -547,11 +580,6 @@ class WebKitWebViewController extends PlatformWebViewController { return Offset(position[0], position[1]); } - /// Whether horizontal swipe gestures trigger page navigation. - Future setAllowsBackForwardNavigationGestures(bool enabled) { - return _webView.setAllowsBackForwardNavigationGestures(enabled); - } - @override Future setBackgroundColor(Color color) { return Future.wait(>[ @@ -620,27 +648,6 @@ class WebKitWebViewController extends PlatformWebViewController { return _webView.setNavigationDelegate(handler._navigationDelegate); } - Future _disableZoom() async { - final WKUserScript userScript = _webKitParams.webKitProxy.newWKUserScript( - source: "var meta = document.createElement('meta');\n" - "meta.name = 'viewport';\n" - "meta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, " - "user-scalable=no';\n" - "var head = document.getElementsByTagName('head')[0];head.appendChild(meta);", - injectionTime: UserScriptInjectionTime.atDocumentEnd, - isForMainFrameOnly: true, - ); - final WKUserContentController controller = - await _webView.configuration.getUserContentController(); - await controller.addUserScript(userScript); - } - - /// Sets the listener for canGoBack changes. - Future setOnCanGoBackChange( - void Function(bool) onCanGoBackChangeCallback) async { - _onCanGoBackChangeCallback = onCanGoBackChangeCallback; - } - /// Sets a callback that notifies the host application of any log messages /// written to the JavaScript console. /// @@ -693,114 +700,28 @@ class WebKitWebViewController extends PlatformWebViewController { return _injectConsoleOverride(); } - Future _injectConsoleOverride() async { - // Within overrideScript, a series of console output methods such as - // console.log will be rewritten to pass the output content to the Flutter - // end. - // - // These output contents will first be serialized through JSON.stringify(), - // but if the output content contains cyclic objects, it will encounter the - // following error. - // TypeError: JSON.stringify cannot serialize cyclic structures. - // See https://github.com/flutter/flutter/issues/144535. - // - // Considering this is just looking at the logs printed via console.log, - // the cyclic object is not important, so remove it. - // Therefore, the replacer parameter of JSON.stringify() is used and the - // removeCyclicObject method is passed in to solve the error. - final WKUserScript overrideScript = - _webKitParams.webKitProxy.newWKUserScript( - source: ''' -var _flutter_webview_plugin_overrides = _flutter_webview_plugin_overrides || { - removeCyclicObject: function() { - const traversalStack = []; - return function (k, v) { - if (typeof v !== "object" || v === null) { return v; } - const currentParentObj = this; - while ( - traversalStack.length > 0 && - traversalStack[traversalStack.length - 1] !== currentParentObj - ) { - traversalStack.pop(); - } - if (traversalStack.includes(v)) { return; } - traversalStack.push(v); - return v; - }; - }, - log: function (type, args) { - var message = Object.values(args) - .map(v => typeof(v) === "undefined" ? "undefined" : typeof(v) === "object" ? JSON.stringify(v, _flutter_webview_plugin_overrides.removeCyclicObject()) : v.toString()) - .map(v => v.substring(0, 3000)) // Limit msg to 3000 chars - .join(", "); - - var log = { - level: type, - message: message + @override + Future setOverScrollMode(WebViewOverScrollMode mode) { + return switch (mode) { + WebViewOverScrollMode.always => Future.wait( + >[ + _webView.scrollView.setBounces(true), + _webView.scrollView.setAlwaysBounceHorizontal(true), + _webView.scrollView.setAlwaysBounceVertical(true), + ], + ), + WebViewOverScrollMode.ifContentScrolls => Future.wait( + >[ + _webView.scrollView.setBounces(true), + _webView.scrollView.setAlwaysBounceHorizontal(false), + _webView.scrollView.setAlwaysBounceVertical(false), + ], + ), + WebViewOverScrollMode.never => _webView.scrollView.setBounces(false), + // This prevents future additions from causing a breaking change. + // ignore: unreachable_switch_case + _ => throw UnsupportedError('This platform does not support $mode.'), }; - - window.webkit.messageHandlers.fltConsoleMessage.postMessage(JSON.stringify(log)); - } -}; - -let originalLog = console.log; -let originalInfo = console.info; -let originalWarn = console.warn; -let originalError = console.error; -let originalDebug = console.debug; - -console.log = function() { _flutter_webview_plugin_overrides.log("log", arguments); originalLog.apply(null, arguments) }; -console.info = function() { _flutter_webview_plugin_overrides.log("info", arguments); originalInfo.apply(null, arguments) }; -console.warn = function() { _flutter_webview_plugin_overrides.log("warning", arguments); originalWarn.apply(null, arguments) }; -console.error = function() { _flutter_webview_plugin_overrides.log("error", arguments); originalError.apply(null, arguments) }; -console.debug = function() { _flutter_webview_plugin_overrides.log("debug", arguments); originalDebug.apply(null, arguments) }; - -window.addEventListener("error", function(e) { - log("error", e.message + " at " + e.filename + ":" + e.lineno + ":" + e.colno); -}); - ''', - injectionTime: UserScriptInjectionTime.atDocumentStart, - isForMainFrameOnly: true, - ); - - final WKUserContentController controller = - await _webView.configuration.getUserContentController(); - await controller.addUserScript(overrideScript); - } - - // WKWebView does not support removing a single user script, so all user - // scripts and all message handlers are removed instead. And the JavaScript - // channels that shouldn't be removed are re-registered. Note that this - // workaround could interfere with exposing support for custom scripts from - // applications. - Future _resetUserScripts({String? removedJavaScriptChannel}) async { - final WKUserContentController controller = - await _webView.configuration.getUserContentController(); - unawaited(controller.removeAllUserScripts()); - // TODO(bparrishMines): This can be replaced with - // `removeAllScriptMessageHandlers` once Dart supports runtime version - // checking. (e.g. The equivalent to @availability in Objective-C.) - _javaScriptChannelParams.keys.forEach( - controller.removeScriptMessageHandler, - ); - final Map remainingChannelParams = - Map.from( - _javaScriptChannelParams, - ); - remainingChannelParams.remove(removedJavaScriptChannel); - _javaScriptChannelParams.clear(); - - await Future.wait(>[ - for (final JavaScriptChannelParams params - in remainingChannelParams.values) - addJavaScriptChannel(params), - // Zoom is disabled with a WKUserScript, so this adds it back if it was - // removed above. - if (!_zoomEnabled) _disableZoom(), - // Console logs are forwarded with a WKUserScript, so this adds it back - // if a console callback was registered with [setOnConsoleMessage]. - if (_onConsoleMessageCallback != null) _injectConsoleOverride(), - ]); } @override @@ -840,18 +761,6 @@ window.addEventListener("error", function(e) { } } - /// Whether to enable tools for debugging the current WKWebView content. - /// - /// It needs to be activated in each WKWebView where you want to enable it. - /// - /// Starting from macOS version 13.3, iOS version 16.4, and tvOS version 16.4, - /// the default value is set to false. - /// - /// Defaults to true in previous versions. - Future setInspectable(bool inspectable) { - return _webView.setInspectable(inspectable); - } - @override Future getUserAgent() async { final String? customUserAgent = await _webView.getCustomUserAgent(); @@ -886,6 +795,131 @@ window.addEventListener("error", function(e) { onJavaScriptTextInputDialog) async { _onJavaScriptTextInputDialog = onJavaScriptTextInputDialog; } + + // WKWebView does not support removing a single user script, so all user + // scripts and all message handlers are removed instead. And the JavaScript + // channels that shouldn't be removed are re-registered. Note that this + // workaround could interfere with exposing support for custom scripts from + // applications. + Future _resetUserScripts({String? removedJavaScriptChannel}) async { + final WKUserContentController controller = + await _webView.configuration.getUserContentController(); + unawaited(controller.removeAllUserScripts()); + // TODO(bparrishMines): This can be replaced with + // `removeAllScriptMessageHandlers` once Dart supports runtime version + // checking. (e.g. The equivalent to @availability in Objective-C.) + _javaScriptChannelParams.keys.forEach( + controller.removeScriptMessageHandler, + ); + final Map remainingChannelParams = + Map.from( + _javaScriptChannelParams, + ); + remainingChannelParams.remove(removedJavaScriptChannel); + _javaScriptChannelParams.clear(); + + await Future.wait(>[ + for (final JavaScriptChannelParams params + in remainingChannelParams.values) + addJavaScriptChannel(params), + // Zoom is disabled with a WKUserScript, so this adds it back if it was + // removed above. + if (!_zoomEnabled) _disableZoom(), + // Console logs are forwarded with a WKUserScript, so this adds it back + // if a console callback was registered with [setOnConsoleMessage]. + if (_onConsoleMessageCallback != null) _injectConsoleOverride(), + ]); + } + + Future _disableZoom() async { + final WKUserScript userScript = _webKitParams.webKitProxy.newWKUserScript( + source: "var meta = document.createElement('meta');\n" + "meta.name = 'viewport';\n" + "meta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, " + "user-scalable=no';\n" + "var head = document.getElementsByTagName('head')[0];head.appendChild(meta);", + injectionTime: UserScriptInjectionTime.atDocumentEnd, + isForMainFrameOnly: true, + ); + final WKUserContentController controller = + await _webView.configuration.getUserContentController(); + await controller.addUserScript(userScript); + } + + Future _injectConsoleOverride() async { + // Within overrideScript, a series of console output methods such as + // console.log will be rewritten to pass the output content to the Flutter + // end. + // + // These output contents will first be serialized through JSON.stringify(), + // but if the output content contains cyclic objects, it will encounter the + // following error. + // TypeError: JSON.stringify cannot serialize cyclic structures. + // See https://github.com/flutter/flutter/issues/144535. + // + // Considering this is just looking at the logs printed via console.log, + // the cyclic object is not important, so remove it. + // Therefore, the replacer parameter of JSON.stringify() is used and the + // removeCyclicObject method is passed in to solve the error. + final WKUserScript overrideScript = + _webKitParams.webKitProxy.newWKUserScript( + source: ''' +var _flutter_webview_plugin_overrides = _flutter_webview_plugin_overrides || { + removeCyclicObject: function() { + const traversalStack = []; + return function (k, v) { + if (typeof v !== "object" || v === null) { return v; } + const currentParentObj = this; + while ( + traversalStack.length > 0 && + traversalStack[traversalStack.length - 1] !== currentParentObj + ) { + traversalStack.pop(); + } + if (traversalStack.includes(v)) { return; } + traversalStack.push(v); + return v; + }; + }, + log: function (type, args) { + var message = Object.values(args) + .map(v => typeof(v) === "undefined" ? "undefined" : typeof(v) === "object" ? JSON.stringify(v, _flutter_webview_plugin_overrides.removeCyclicObject()) : v.toString()) + .map(v => v.substring(0, 3000)) // Limit msg to 3000 chars + .join(", "); + + var log = { + level: type, + message: message + }; + + window.webkit.messageHandlers.fltConsoleMessage.postMessage(JSON.stringify(log)); + } +}; + +let originalLog = console.log; +let originalInfo = console.info; +let originalWarn = console.warn; +let originalError = console.error; +let originalDebug = console.debug; + +console.log = function() { _flutter_webview_plugin_overrides.log("log", arguments); originalLog.apply(null, arguments) }; +console.info = function() { _flutter_webview_plugin_overrides.log("info", arguments); originalInfo.apply(null, arguments) }; +console.warn = function() { _flutter_webview_plugin_overrides.log("warning", arguments); originalWarn.apply(null, arguments) }; +console.error = function() { _flutter_webview_plugin_overrides.log("error", arguments); originalError.apply(null, arguments) }; +console.debug = function() { _flutter_webview_plugin_overrides.log("debug", arguments); originalDebug.apply(null, arguments) }; + +window.addEventListener("error", function(e) { + log("error", e.message + " at " + e.filename + ":" + e.lineno + ":" + e.colno); +}); + ''', + injectionTime: UserScriptInjectionTime.atDocumentStart, + isForMainFrameOnly: true, + ); + + final WKUserContentController controller = + await _webView.configuration.getUserContentController(); + await controller.addUserScript(overrideScript); + } } /// An implementation of [JavaScriptChannelParams] with the WebKit api. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart index 3349c34105a..0cf38a4e9ee 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -915,6 +915,12 @@ abstract class UIViewWKWebView extends UIView implements WKWebView { /// The custom user agent string. String? getCustomUserAgent(); + + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// Defaults to true. + void setAllowsLinkPreview(bool allow); } /// An object that displays interactive web content, such as for an in-app @@ -998,6 +1004,12 @@ abstract class NSViewWKWebView extends NSObject implements WKWebView { /// The custom user agent string. String? getCustomUserAgent(); + + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// Defaults to true. + void setAllowsLinkPreview(bool allow); } /// An object that displays interactive web content, such as for an in-app diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index 73efba1dc8b..64bf86387d4 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_wkwebview description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 3.18.6 +version: 3.20.0 environment: sdk: ^3.5.0 @@ -25,7 +25,7 @@ dependencies: flutter: sdk: flutter path: ^1.8.0 - webview_flutter_platform_interface: ^2.10.0 + webview_flutter_platform_interface: ^2.11.0 dev_dependencies: build_runner: ^2.1.5 diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.mocks.dart index 94e5749c461..88df3f478fc 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.mocks.dart @@ -799,6 +799,13 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { returnValue: _i4.Future.value(), ) as _i4.Future); + @override + _i4.Future setAllowsLinkPreview(bool? allow) => (super.noSuchMethod( + Invocation.method(#setAllowsLinkPreview, [allow]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override _i2.UIViewWKWebView pigeon_copy() => (super.noSuchMethod( Invocation.method(#pigeon_copy, []), diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart index e6a350de4e6..c31ee0f790f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart @@ -1383,6 +1383,30 @@ void main() { expect(urlChange.url, null); }); + test('setOverScrollMode', () async { + final MockUIScrollView mockScrollView = MockUIScrollView(); + + final WebKitWebViewController controller = createControllerWithMocks( + mockScrollView: mockScrollView, + ); + + await controller.setOverScrollMode(WebViewOverScrollMode.always); + verify(mockScrollView.setBounces(true)); + verify(mockScrollView.setAlwaysBounceVertical(true)); + verify(mockScrollView.setAlwaysBounceHorizontal(true)); + + clearInteractions(mockScrollView); + await controller + .setOverScrollMode(WebViewOverScrollMode.ifContentScrolls); + verify(mockScrollView.setBounces(true)); + verify(mockScrollView.setAlwaysBounceVertical(false)); + verify(mockScrollView.setAlwaysBounceHorizontal(false)); + + clearInteractions(mockScrollView); + await controller.setOverScrollMode(WebViewOverScrollMode.never); + verify(mockScrollView.setBounces(false)); + }); + test('webViewIdentifier', () { final PigeonInstanceManager instanceManager = TestInstanceManager(); @@ -1578,6 +1602,17 @@ void main() { verify(mockWebView.setInspectable(true)); }); + test('setAllowsLinkPreview', () async { + final MockUIViewWKWebView mockWebView = MockUIViewWKWebView(); + + final WebKitWebViewController controller = createControllerWithMocks( + createMockWebView: (_, {dynamic observeValue}) => mockWebView, + ); + + await controller.setAllowsLinkPreview(true); + verify(mockWebView.setAllowsLinkPreview(true)); + }); + group('Console logging', () { test('setConsoleLogCallback should inject the correct JavaScript', () async { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart index 59f32c8c453..3bbeec9f6c3 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart @@ -1261,6 +1261,13 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); + @override + _i3.Future setAllowsLinkPreview(bool? allow) => (super.noSuchMethod( + Invocation.method(#setAllowsLinkPreview, [allow]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + @override _i2.UIViewWKWebView pigeon_copy() => (super.noSuchMethod( Invocation.method(#pigeon_copy, []), diff --git a/script/tool/lib/src/analyze_command.dart b/script/tool/lib/src/analyze_command.dart index 4651dbb42c7..51a2403ab2e 100644 --- a/script/tool/lib/src/analyze_command.dart +++ b/script/tool/lib/src/analyze_command.dart @@ -6,6 +6,7 @@ import 'dart:io' as io; import 'package:file/file.dart'; +import 'common/file_filters.dart'; import 'common/output_utils.dart'; import 'common/package_looping_command.dart'; import 'common/repository_package.dart'; @@ -92,6 +93,13 @@ class AnalyzeCommand extends PackageLoopingCommand { return false; } + @override + bool shouldIgnoreFile(String path) { + return isRepoLevelNonCodeImpactingFile(path) || + isNativeCodeFile(path) || + isPackageSupportFile(path); + } + @override Future initializeRun() async { _allowedCustomAnalysisDirectories = getYamlListArg(_customAnalysisFlag); diff --git a/script/tool/lib/src/build_examples_command.dart b/script/tool/lib/src/build_examples_command.dart index 4a5c0272853..932e3090a39 100644 --- a/script/tool/lib/src/build_examples_command.dart +++ b/script/tool/lib/src/build_examples_command.dart @@ -6,6 +6,7 @@ import 'package:file/file.dart'; import 'package:yaml/yaml.dart'; import 'common/core.dart'; +import 'common/file_filters.dart'; import 'common/output_utils.dart'; import 'common/package_looping_command.dart'; import 'common/plugin_utils.dart'; @@ -134,6 +135,11 @@ class BuildExamplesCommand extends PackageLoopingCommand { return getNullableBoolArg(_swiftPackageManagerFlag); } + @override + bool shouldIgnoreFile(String path) { + return isRepoLevelNonCodeImpactingFile(path) || isPackageSupportFile(path); + } + @override Future initializeRun() async { final List platformFlags = _platforms.keys.toList(); diff --git a/script/tool/lib/src/common/file_filters.dart b/script/tool/lib/src/common/file_filters.dart new file mode 100644 index 00000000000..b1eb0899f29 --- /dev/null +++ b/script/tool/lib/src/common/file_filters.dart @@ -0,0 +1,53 @@ +// 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. + +/// Returns true for repository-level paths of files that do not affect *any* +/// code-related commands (example builds, Dart analysis, native code analysis, +/// native tests, Dart tests, etc.) for use in command-ignored-files lists for +/// commands that are only affected by package code. +bool isRepoLevelNonCodeImpactingFile(String path) { + return [ + 'AUTHORS', + 'CODEOWNERS', + 'CONTRIBUTING.md', + 'LICENSE', + 'README.md', + // This deliberate lists specific files rather than excluding the whole + // .github directory since it's better to have false negatives than to + // accidentally skip tests if something is later added to the directory + // that could affect packages. + '.github/PULL_REQUEST_TEMPLATE.md', + '.github/dependabot.yml', + '.github/labeler.yml', + '.github/post_merge_labeler.yml', + '.github/workflows/pull_request_label.yml', + ].contains(path); +} + +/// Returns true for native (non-Dart) code files, for use in command-ignored- +/// files lists for commands that aren't affected by native code (e.g., Dart +/// analysis and unit tests). +bool isNativeCodeFile(String path) { + return path.endsWith('.c') || + path.endsWith('.cc') || + path.endsWith('.cpp') || + path.endsWith('.h') || + path.endsWith('.m') || + path.endsWith('.swift') || + path.endsWith('.java') || + path.endsWith('.kt'); +} + +/// Returns true for package-level human-focused support files, for use in +/// command-ignored-files lists for commands that aren't affected by files that +/// aren't used in any builds. +/// +/// This must *not* include metadata files that do affect builds, such as +/// pubspec.yaml. +bool isPackageSupportFile(String path) { + return path.endsWith('/AUTHORS') || + path.endsWith('/CHANGELOG.md') || + path.endsWith('/CONTRIBUTING.md') || + path.endsWith('/README.md'); +} diff --git a/script/tool/lib/src/common/package_looping_command.dart b/script/tool/lib/src/common/package_looping_command.dart index 4ac90ae80b6..6ac17df37c0 100644 --- a/script/tool/lib/src/common/package_looping_command.dart +++ b/script/tool/lib/src/common/package_looping_command.dart @@ -109,6 +109,20 @@ abstract class PackageLoopingCommand extends PackageCommand { /// The package currently being run by [runForPackage]. PackageEnumerationEntry? _currentPackageEntry; + /// When running against a merge base, this is called before [initializeRun] + /// for every changed file, to see if that file is a file that is guaranteed + /// *not* to require running this command. + /// + /// If every changed file returns true, then the command will be skipped. + /// Because this causes tests not to run, subclasses should be very + /// consevative about what returns true; for anything borderline it is much + /// better to err on the side of running tests unnecessarily than to risk + /// losing test coverage. + /// + /// [path] is a POSIX-style path regardless of the host platforrm, and is + /// relative to the git repo root. + bool shouldIgnoreFile(String path) => false; + /// Called during [run] before any calls to [runForPackage]. This provides an /// opportunity to fail early if the command can't be run (e.g., because the /// arguments are invalid), and to set up any run-level state. @@ -281,6 +295,14 @@ abstract class PackageLoopingCommand extends PackageCommand { baseSha = await gitVersionFinder.getBaseSha(); changedFiles = await gitVersionFinder.getChangedFiles(); + // Check whether the command needs to run. + if (changedFiles.isNotEmpty && changedFiles.every(shouldIgnoreFile)) { + _printColorized( + 'SKIPPING ALL PACKAGES: No changed files affect this command', + Styles.DARK_GRAY); + return true; + } + await initializeRun(); final List targetPackages = diff --git a/script/tool/lib/src/dart_test_command.dart b/script/tool/lib/src/dart_test_command.dart index 5e99211169e..f5189e557cb 100644 --- a/script/tool/lib/src/dart_test_command.dart +++ b/script/tool/lib/src/dart_test_command.dart @@ -5,6 +5,7 @@ import 'package:file/file.dart'; import 'common/core.dart'; +import 'common/file_filters.dart'; import 'common/output_utils.dart'; import 'common/package_looping_command.dart'; import 'common/plugin_utils.dart'; @@ -65,6 +66,13 @@ class DartTestCommand extends PackageLoopingCommand { PackageLoopingType get packageLoopingType => PackageLoopingType.includeAllSubpackages; + @override + bool shouldIgnoreFile(String path) { + return isRepoLevelNonCodeImpactingFile(path) || + isNativeCodeFile(path) || + isPackageSupportFile(path); + } + @override Future runForPackage(RepositoryPackage package) async { if (!package.testDirectory.existsSync()) { diff --git a/script/tool/lib/src/drive_examples_command.dart b/script/tool/lib/src/drive_examples_command.dart index c26c4850072..84689bcb5aa 100644 --- a/script/tool/lib/src/drive_examples_command.dart +++ b/script/tool/lib/src/drive_examples_command.dart @@ -9,6 +9,7 @@ import 'dart:io'; import 'package:file/file.dart'; import 'common/core.dart'; +import 'common/file_filters.dart'; import 'common/output_utils.dart'; import 'common/package_looping_command.dart'; import 'common/plugin_utils.dart'; @@ -68,6 +69,11 @@ class DriveExamplesCommand extends PackageLoopingCommand { Map> _targetDeviceFlags = const >{}; + @override + bool shouldIgnoreFile(String path) { + return isRepoLevelNonCodeImpactingFile(path) || isPackageSupportFile(path); + } + @override Future initializeRun() async { final List platformSwitches = [ diff --git a/script/tool/lib/src/firebase_test_lab_command.dart b/script/tool/lib/src/firebase_test_lab_command.dart index 445a5aec511..9a95507f9a3 100644 --- a/script/tool/lib/src/firebase_test_lab_command.dart +++ b/script/tool/lib/src/firebase_test_lab_command.dart @@ -8,6 +8,7 @@ import 'package:file/file.dart'; import 'package:uuid/uuid.dart'; import 'common/core.dart'; +import 'common/file_filters.dart'; import 'common/flutter_command_utils.dart'; import 'common/gradle.dart'; import 'common/output_utils.dart'; @@ -122,6 +123,11 @@ class FirebaseTestLabCommand extends PackageLoopingCommand { _firebaseProjectConfigured = true; } + @override + bool shouldIgnoreFile(String path) { + return isRepoLevelNonCodeImpactingFile(path) || isPackageSupportFile(path); + } + @override Future runForPackage(RepositoryPackage package) async { final List results = []; diff --git a/script/tool/lib/src/lint_android_command.dart b/script/tool/lib/src/lint_android_command.dart index e9d49b9b459..b7dff59a68d 100644 --- a/script/tool/lib/src/lint_android_command.dart +++ b/script/tool/lib/src/lint_android_command.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. import 'common/core.dart'; +import 'common/file_filters.dart'; import 'common/flutter_command_utils.dart'; import 'common/gradle.dart'; import 'common/output_utils.dart'; @@ -29,6 +30,15 @@ class LintAndroidCommand extends PackageLoopingCommand { final String description = 'Runs "gradlew lint" on Android plugins.\n\n' 'Requires the examples to have been build at least once before running.'; + @override + bool shouldIgnoreFile(String path) { + return isRepoLevelNonCodeImpactingFile(path) || + isPackageSupportFile(path) || + // These are part of the build, but don't affect native code analysis. + path.endsWith('/pubspec.yaml') || + path.endsWith('.dart'); + } + @override Future runForPackage(RepositoryPackage package) async { if (!pluginSupportsPlatform(platformAndroid, package, diff --git a/script/tool/lib/src/native_test_command.dart b/script/tool/lib/src/native_test_command.dart index 6714b68f607..35498b4c29f 100644 --- a/script/tool/lib/src/native_test_command.dart +++ b/script/tool/lib/src/native_test_command.dart @@ -9,6 +9,7 @@ import 'package:meta/meta.dart'; import 'common/cmake.dart'; import 'common/core.dart'; +import 'common/file_filters.dart'; import 'common/flutter_command_utils.dart'; import 'common/gradle.dart'; import 'common/output_utils.dart'; @@ -114,6 +115,13 @@ this command. Set _xcodeWarningsExceptions = {}; + @override + bool shouldIgnoreFile(String path) { + return isRepoLevelNonCodeImpactingFile(path) || isPackageSupportFile(path); + // It may seem tempting to filter out *.dart, but that would skip critical + // testing since native integration tests run the full compiled application. + } + @override Future initializeRun() async { _platforms = { @@ -433,12 +441,12 @@ this command. } Future<_PlatformResult> _testIOS(RepositoryPackage plugin, _TestMode mode) { - return _runXcodeTests(plugin, 'iOS', mode, + return _runXcodeTests(plugin, FlutterPlatform.ios, mode, extraFlags: _iOSDestinationFlags); } Future<_PlatformResult> _testMacOS(RepositoryPackage plugin, _TestMode mode) { - return _runXcodeTests(plugin, 'macOS', mode); + return _runXcodeTests(plugin, FlutterPlatform.macos, mode); } /// Runs all applicable tests for [plugin], printing status and returning @@ -448,7 +456,7 @@ this command. /// usually at "example/{ios,macos}/Runner.xcworkspace". Future<_PlatformResult> _runXcodeTests( RepositoryPackage plugin, - String targetPlatform, + FlutterPlatform targetPlatform, _TestMode mode, { List extraFlags = const [], }) async { @@ -459,6 +467,8 @@ this command. } else if (mode.integrationOnly) { testTarget = 'RunnerUITests'; } + final String targetPlatformString = + targetPlatform == FlutterPlatform.ios ? 'iOS' : 'macOS'; bool ranUnitTests = false; // Assume skipped until at least one test has run. @@ -472,8 +482,8 @@ this command. bool exampleHasUnitTests = false; final String? targetToCheck = testTarget ?? (mode.unit ? unitTestTarget : null); - final Directory xcodeProject = example.directory - .childDirectory(targetPlatform.toLowerCase()) + final Directory xcodeProject = example + .platformDirectory(targetPlatform) .childDirectory('Runner.xcodeproj'); if (targetToCheck != null) { final bool? hasTarget = @@ -490,14 +500,29 @@ this command. } } - _printRunningExampleTestsMessage(example, targetPlatform); + // Ensure that the native project files are configured for a debug build, + // otherwise the Xcode build step will fail due to mode mismatch. + final bool buildSuccess = await runConfigOnlyBuild( + example, + processRunner, + platform, + targetPlatform, + buildDebug: true, + ); + if (!buildSuccess) { + printError('Unable to generate debug Xcode project files'); + overallResult = RunState.failed; + continue; + } + + _printRunningExampleTestsMessage(example, targetPlatformString); final int exitCode = await _xcode.runXcodeBuild( example.directory, - targetPlatform, + targetPlatformString, // Clean before testing to remove cached swiftmodules from previous // runs, which can cause conflicts. actions: ['clean', 'test'], - workspace: '${targetPlatform.toLowerCase()}/Runner.xcworkspace', + workspace: '${targetPlatformString.toLowerCase()}/Runner.xcworkspace', scheme: 'Runner', configuration: 'Debug', hostPlatform: platform, @@ -513,10 +538,10 @@ this command. const int xcodebuildNoTestExitCode = 66; switch (exitCode) { case xcodebuildNoTestExitCode: - _printNoExampleTestsMessage(example, targetPlatform); + _printNoExampleTestsMessage(example, targetPlatformString); case 0: printSuccess( - 'Successfully ran $targetPlatform xctest for $exampleName'); + 'Successfully ran $targetPlatformString xctest for $exampleName'); // If this is the first test, assume success until something fails. if (overallResult == RunState.skipped) { overallResult = RunState.succeeded; diff --git a/script/tool/lib/src/xcode_analyze_command.dart b/script/tool/lib/src/xcode_analyze_command.dart index 7629a4e7346..8494550bc77 100644 --- a/script/tool/lib/src/xcode_analyze_command.dart +++ b/script/tool/lib/src/xcode_analyze_command.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. import 'common/core.dart'; +import 'common/file_filters.dart'; import 'common/flutter_command_utils.dart'; import 'common/output_utils.dart'; import 'common/package_looping_command.dart'; @@ -47,6 +48,15 @@ class XcodeAnalyzeCommand extends PackageLoopingCommand { final String description = 'Runs Xcode analysis on the iOS and/or macOS example apps.'; + @override + bool shouldIgnoreFile(String path) { + return isRepoLevelNonCodeImpactingFile(path) || + isPackageSupportFile(path) || + // These are part of the build, but don't affect native code analysis. + path.endsWith('/pubspec.yaml') || + path.endsWith('.dart'); + } + @override Future initializeRun() async { if (!(getBoolArg(platformIOS) || getBoolArg(platformMacOS))) { diff --git a/script/tool/test/analyze_command_test.dart b/script/tool/test/analyze_command_test.dart index f27503cabff..b60cd63b9c5 100644 --- a/script/tool/test/analyze_command_test.dart +++ b/script/tool/test/analyze_command_test.dart @@ -16,12 +16,13 @@ void main() { late MockPlatform mockPlatform; late Directory packagesDir; late RecordingProcessRunner processRunner; + late RecordingProcessRunner gitProcessRunner; late CommandRunner runner; setUp(() { mockPlatform = MockPlatform(); final GitDir gitDir; - (:packagesDir, :processRunner, gitProcessRunner: _, :gitDir) = + (:packagesDir, :processRunner, :gitProcessRunner, :gitDir) = configureBaseCommandMocks(platform: mockPlatform); final AnalyzeCommand analyzeCommand = AnalyzeCommand( packagesDir, @@ -470,4 +471,90 @@ void main() { ]), ); }); + + group('file filtering', () { + test('runs command for changes to Dart source', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +packages/package_a/foo.dart +''')), + ]; + + final List output = + await runCapturingPrint(runner, ['analyze']); + + expect( + output, + containsAllInOrder([ + contains('Running for package_a'), + ])); + }); + + const List files = [ + 'foo.java', + 'foo.kt', + 'foo.m', + 'foo.swift', + 'foo.c', + 'foo.cc', + 'foo.cpp', + 'foo.h', + ]; + for (final String file in files) { + test('skips command for changes to non-Dart source $file', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +packages/package_a/$file +''')), + ]; + + final List output = + await runCapturingPrint(runner, ['analyze']); + + expect( + output, + isNot(containsAllInOrder([ + contains('Running for package_a'), + ]))); + expect( + output, + containsAllInOrder([ + contains('SKIPPING ALL PACKAGES'), + ])); + }); + } + + test('skips commands if all files should be ignored', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +README.md +CODEOWNERS +packages/package_a/CHANGELOG.md +''')), + ]; + + final List output = + await runCapturingPrint(runner, ['analyze']); + + expect( + output, + isNot(containsAllInOrder([ + contains('Running for package_a'), + ]))); + expect( + output, + containsAllInOrder([ + contains('SKIPPING ALL PACKAGES'), + ])); + }); + }); } diff --git a/script/tool/test/build_examples_command_test.dart b/script/tool/test/build_examples_command_test.dart index 2e2a2112baa..98ebe28ffa5 100644 --- a/script/tool/test/build_examples_command_test.dart +++ b/script/tool/test/build_examples_command_test.dart @@ -19,11 +19,12 @@ void main() { late Directory packagesDir; late CommandRunner runner; late RecordingProcessRunner processRunner; + late RecordingProcessRunner gitProcessRunner; setUp(() { mockPlatform = MockPlatform(); final GitDir gitDir; - (:packagesDir, :processRunner, gitProcessRunner: _, :gitDir) = + (:packagesDir, :processRunner, :gitProcessRunner, :gitDir) = configureBaseCommandMocks(platform: mockPlatform); final BuildExamplesCommand command = BuildExamplesCommand( packagesDir, @@ -998,5 +999,72 @@ void main() { pluginExampleDirectory.path), ])); }); + + group('file filtering', () { + const List files = [ + 'pubspec.yaml', + 'foo.dart', + 'foo.java', + 'foo.kt', + 'foo.m', + 'foo.swift', + 'foo.cc', + 'foo.cpp', + 'foo.h', + ]; + for (final String file in files) { + test('runs command for changes to $file', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +packages/package_a/$file +''')), + ]; + + // The target platform is irrelevant here; because this repo's + // packages are fully federated, there's no need to distinguish + // the ignore list by target (e.g., skipping iOS tests if only Java or + // Kotlin files change), because package-level filering will already + // accomplish the same goal. + final List output = await runCapturingPrint( + runner, ['build-examples', '--web']); + + expect( + output, + containsAllInOrder([ + contains('Running for package_a'), + ])); + }); + } + + test('skips commands if all files should be ignored', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +README.md +CODEOWNERS +packages/package_a/CHANGELOG.md +''')), + ]; + + final List output = + await runCapturingPrint(runner, ['build-examples']); + + expect( + output, + isNot(containsAllInOrder([ + contains('Running for package_a'), + ]))); + expect( + output, + containsAllInOrder([ + contains('SKIPPING ALL PACKAGES'), + ])); + }); + }); }); } diff --git a/script/tool/test/common/package_looping_command_test.dart b/script/tool/test/common/package_looping_command_test.dart index 6474dff8025..d2247b9d488 100644 --- a/script/tool/test/common/package_looping_command_test.dart +++ b/script/tool/test/common/package_looping_command_test.dart @@ -10,12 +10,11 @@ import 'package:file/file.dart'; import 'package:flutter_plugin_tools/src/common/core.dart'; import 'package:flutter_plugin_tools/src/common/output_utils.dart'; import 'package:flutter_plugin_tools/src/common/package_looping_command.dart'; -import 'package:mockito/mockito.dart'; +import 'package:git/git.dart'; import 'package:test/test.dart'; import '../mocks.dart'; import '../util.dart'; -import 'package_command_test.mocks.dart'; // Constants for colorized output start and end. const String _startElapsedTimeColor = '\x1B[90m'; @@ -79,10 +78,12 @@ void main() { late MockPlatform mockPlatform; late Directory packagesDir; late Directory thirdPartyPackagesDir; + late GitDir gitDir; + late RecordingProcessRunner gitProcessRunner; setUp(() { mockPlatform = MockPlatform(); - (:packagesDir, processRunner: _, gitProcessRunner: _, gitDir: _) = + (:packagesDir, processRunner: _, :gitProcessRunner, :gitDir) = configureBaseCommandMocks(platform: mockPlatform); // Correct color handling is part of the behavior being tested here. useColorForOutput = true; @@ -96,10 +97,8 @@ void main() { useColorForOutput = io.stdout.supportsAnsiEscapes; }); - /// Creates a TestPackageLoopingCommand instance that uses [gitDiffResponse] - /// for git diffs, and logs output to [printOutput]. + /// Creates a TestPackageLoopingCommand with the given configuration. TestPackageLoopingCommand createTestCommand({ - String gitDiffResponse = '', bool hasLongOutput = true, PackageLoopingType packageLoopingType = PackageLoopingType.topLevelOnly, bool failsDuringInit = false, @@ -108,20 +107,6 @@ void main() { String? customFailureListHeader, String? customFailureListFooter, }) { - // Set up the git diff response. - final MockGitDir gitDir = MockGitDir(); - when(gitDir.runCommand(any, throwOnError: anyNamed('throwOnError'))) - .thenAnswer((Invocation invocation) { - final List arguments = - invocation.positionalArguments[0]! as List; - String? gitStdOut; - if (arguments[0] == 'diff') { - gitStdOut = gitDiffResponse; - } - return Future.value( - io.ProcessResult(0, 0, gitStdOut ?? '', '')); - }); - return TestPackageLoopingCommand( packagesDir, platform: mockPlatform, @@ -212,6 +197,77 @@ void main() { }); }); + group('file filtering', () { + test('runs command if the changed files list is empty', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: '')), + ]; + + final TestPackageLoopingCommand command = + createTestCommand(hasLongOutput: false); + final List output = await runCommand(command); + + expect( + output, + containsAllInOrder([ + '${_startHeadingColor}Running for package_a...$_endColor', + ])); + }); + + test('runs command if any files are not ignored', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +skip/a +other +skip/b +''')), + ]; + + final TestPackageLoopingCommand command = + createTestCommand(hasLongOutput: false); + final List output = await runCommand(command); + + expect( + output, + containsAllInOrder([ + '${_startHeadingColor}Running for package_a...$_endColor', + ])); + }); + + test('skips commands if all files should be ignored', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +skip/a +skip/b +''')), + ]; + + final TestPackageLoopingCommand command = + createTestCommand(hasLongOutput: false); + final List output = await runCommand(command); + + expect( + output, + isNot(containsAllInOrder([ + contains('Running for package_a'), + ]))); + expect( + output, + containsAllInOrder([ + '${_startSkipColor}SKIPPING ALL PACKAGES: No changed files affect this command$_endColor', + ])); + }); + }); + group('package iteration', () { test('includes plugins and packages', () async { final RepositoryPackage plugin = @@ -898,6 +954,11 @@ class TestPackageLoopingCommand extends PackageLoopingCommand { @override final String description = 'sample package looping command'; + @override + bool shouldIgnoreFile(String path) { + return path.startsWith('skip/'); + } + @override Future initializeRun() async { if (warnsDuringInit) { diff --git a/script/tool/test/dart_test_command_test.dart b/script/tool/test/dart_test_command_test.dart index 0c12634a766..6b4d6cb4512 100644 --- a/script/tool/test/dart_test_command_test.dart +++ b/script/tool/test/dart_test_command_test.dart @@ -20,11 +20,12 @@ void main() { late Directory packagesDir; late CommandRunner runner; late RecordingProcessRunner processRunner; + late RecordingProcessRunner gitProcessRunner; setUp(() { mockPlatform = MockPlatform(); final GitDir gitDir; - (:packagesDir, :processRunner, gitProcessRunner: _, :gitDir) = + (:packagesDir, :processRunner, :gitProcessRunner, :gitDir) = configureBaseCommandMocks(platform: mockPlatform); final DartTestCommand command = DartTestCommand( packagesDir, @@ -713,5 +714,91 @@ test_on: !vm && firefox ]), ); }); + + group('file filtering', () { + test('runs command for changes to Dart source', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +packages/package_a/foo.dart +''')), + ]; + + final List output = + await runCapturingPrint(runner, ['test']); + + expect( + output, + containsAllInOrder([ + contains('Running for package_a'), + ])); + }); + + const List files = [ + 'foo.java', + 'foo.kt', + 'foo.m', + 'foo.swift', + 'foo.c', + 'foo.cc', + 'foo.cpp', + 'foo.h', + ]; + for (final String file in files) { + test('skips command for changes to non-Dart source $file', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +packages/package_a/$file +''')), + ]; + + final List output = + await runCapturingPrint(runner, ['test']); + + expect( + output, + isNot(containsAllInOrder([ + contains('Running for package_a'), + ]))); + expect( + output, + containsAllInOrder([ + contains('SKIPPING ALL PACKAGES'), + ])); + }); + } + + test('skips commands if all files should be ignored', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +README.md +CODEOWNERS +packages/package_a/CHANGELOG.md +''')), + ]; + + final List output = + await runCapturingPrint(runner, ['test']); + + expect( + output, + isNot(containsAllInOrder([ + contains('Running for package_a'), + ]))); + expect( + output, + containsAllInOrder([ + contains('SKIPPING ALL PACKAGES'), + ])); + }); + }); }); } diff --git a/script/tool/test/drive_examples_command_test.dart b/script/tool/test/drive_examples_command_test.dart index 8ee59212135..b556124f585 100644 --- a/script/tool/test/drive_examples_command_test.dart +++ b/script/tool/test/drive_examples_command_test.dart @@ -28,11 +28,12 @@ void main() { late Directory packagesDir; late CommandRunner runner; late RecordingProcessRunner processRunner; + late RecordingProcessRunner gitProcessRunner; setUp(() { mockPlatform = MockPlatform(); final GitDir gitDir; - (:packagesDir, :processRunner, gitProcessRunner: _, :gitDir) = + (:packagesDir, :processRunner, :gitProcessRunner, :gitDir) = configureBaseCommandMocks(platform: mockPlatform); final DriveExamplesCommand command = DriveExamplesCommand( packagesDir, @@ -1714,6 +1715,73 @@ void main() { expect(processRunner.recordedCalls.isEmpty, true); }); }); + + group('file filtering', () { + const List files = [ + 'pubspec.yaml', + 'foo.dart', + 'foo.java', + 'foo.kt', + 'foo.m', + 'foo.swift', + 'foo.cc', + 'foo.cpp', + 'foo.h', + ]; + for (final String file in files) { + test('runs command for changes to $file', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +packages/package_a/$file +''')), + ]; + + // The target platform is irrelevant here; because this repo's + // packages are fully federated, there's no need to distinguish + // the ignore list by target (e.g., skipping iOS tests if only Java or + // Kotlin files change), because package-level filering will already + // accomplish the same goal. + final List output = await runCapturingPrint( + runner, ['drive-examples', '--web']); + + expect( + output, + containsAllInOrder([ + contains('Running for package_a'), + ])); + }); + } + + test('skips commands if all files should be ignored', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +README.md +CODEOWNERS +packages/package_a/CHANGELOG.md +''')), + ]; + + final List output = + await runCapturingPrint(runner, ['drive-examples']); + + expect( + output, + isNot(containsAllInOrder([ + contains('Running for package_a'), + ]))); + expect( + output, + containsAllInOrder([ + contains('SKIPPING ALL PACKAGES'), + ])); + }); + }); }); } diff --git a/script/tool/test/firebase_test_lab_command_test.dart b/script/tool/test/firebase_test_lab_command_test.dart index f3d2b21e171..fa139f31a2e 100644 --- a/script/tool/test/firebase_test_lab_command_test.dart +++ b/script/tool/test/firebase_test_lab_command_test.dart @@ -20,11 +20,12 @@ void main() { late Directory packagesDir; late CommandRunner runner; late RecordingProcessRunner processRunner; + late RecordingProcessRunner gitProcessRunner; setUp(() { mockPlatform = MockPlatform(); final GitDir gitDir; - (:packagesDir, :processRunner, gitProcessRunner: _, :gitDir) = + (:packagesDir, :processRunner, :gitProcessRunner, :gitDir) = configureBaseCommandMocks(platform: mockPlatform); final FirebaseTestLabCommand command = FirebaseTestLabCommand( packagesDir, @@ -881,5 +882,75 @@ class MainActivityTest { ]), ); }); + + group('file filtering', () { + const List files = [ + 'pubspec.yaml', + 'foo.dart', + 'foo.java', + 'foo.kt', + 'foo.m', + 'foo.swift', + 'foo.cc', + 'foo.cpp', + 'foo.h', + ]; + for (final String file in files) { + test('runs command for changes to $file', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +packages/package_a/$file +''')), + ]; + + final List output = await runCapturingPrint(runner, [ + 'firebase-test-lab', + '--results-bucket=a_bucket', + '--device', + 'model=redfin,version=30', + ]); + + expect( + output, + containsAllInOrder([ + contains('Running for package_a'), + ])); + }); + } + + test('skips commands if all files should be ignored', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +README.md +CODEOWNERS +packages/package_a/CHANGELOG.md +''')), + ]; + + final List output = await runCapturingPrint(runner, [ + 'firebase-test-lab', + '--results-bucket=a_bucket', + '--device', + 'model=redfin,version=30', + ]); + + expect( + output, + isNot(containsAllInOrder([ + contains('Running for package_a'), + ]))); + expect( + output, + containsAllInOrder([ + contains('SKIPPING ALL PACKAGES'), + ])); + }); + }); }); } diff --git a/script/tool/test/lint_android_command_test.dart b/script/tool/test/lint_android_command_test.dart index 8ac1bccfa82..543c6ceff30 100644 --- a/script/tool/test/lint_android_command_test.dart +++ b/script/tool/test/lint_android_command_test.dart @@ -19,11 +19,12 @@ void main() { late CommandRunner runner; late MockPlatform mockPlatform; late RecordingProcessRunner processRunner; + late RecordingProcessRunner gitProcessRunner; setUp(() { mockPlatform = MockPlatform(); final GitDir gitDir; - (:packagesDir, :processRunner, gitProcessRunner: _, :gitDir) = + (:packagesDir, :processRunner, :gitProcessRunner, :gitDir) = configureBaseCommandMocks(platform: mockPlatform); final LintAndroidCommand command = LintAndroidCommand( packagesDir, @@ -241,5 +242,61 @@ void main() { ], )); }); + + group('file filtering', () { + const List files = [ + 'foo.java', + 'foo.kt', + ]; + for (final String file in files) { + test('runs command for changes to $file', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +packages/package_a/$file +''')), + ]; + + final List output = + await runCapturingPrint(runner, ['lint-android']); + + expect( + output, + containsAllInOrder([ + contains('Running for package_a'), + ])); + }); + } + + test('skips commands if all files should be ignored', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +README.md +CODEOWNERS +packages/package_a/CHANGELOG.md +packages/package_a/lib/foo.dart +''')), + ]; + + final List output = + await runCapturingPrint(runner, ['lint-android']); + + expect( + output, + isNot(containsAllInOrder([ + contains('Running for package_a'), + ]))); + expect( + output, + containsAllInOrder([ + contains('SKIPPING ALL PACKAGES'), + ])); + }); + }); }); } diff --git a/script/tool/test/native_test_command_test.dart b/script/tool/test/native_test_command_test.dart index 0a9924727ef..10ff16de2e6 100644 --- a/script/tool/test/native_test_command_test.dart +++ b/script/tool/test/native_test_command_test.dart @@ -84,6 +84,7 @@ void main() { late Directory packagesDir; late CommandRunner runner; late RecordingProcessRunner processRunner; + late RecordingProcessRunner gitProcessRunner; setUp(() { // iOS and macOS tests expect macOS, Linux tests expect Linux; nothing @@ -91,7 +92,7 @@ void main() { // allow them to share a setup group. mockPlatform = MockPlatform(isMacOS: true, isLinux: true); final GitDir gitDir; - (:packagesDir, :processRunner, gitProcessRunner: _, :gitDir) = + (:packagesDir, :processRunner, :gitProcessRunner, :gitDir) = configureBaseCommandMocks(platform: mockPlatform); final NativeTestCommand command = NativeTestCommand( packagesDir, @@ -135,6 +136,21 @@ void main() { null); } + // Returns the ProcessCall to expect for generating the native project files + // with a --config-only build on iOS or macOS. + ProcessCall getConfigOnlyDarwinBuildCall( + Directory package, FlutterPlatform platform) { + return ProcessCall( + 'flutter', + [ + 'build', + if (platform == FlutterPlatform.ios) 'ios' else 'macos', + '--debug', + '--config-only', + ], + package.path); + } + // Returns the ProcessCall to expect for running the tests in the // workspace [platform]/Runner.xcworkspace, with the given extra flags. ProcessCall getRunTestCall( @@ -246,6 +262,8 @@ void main() { processRunner.recordedCalls, orderedEquals([ getTargetCheckCall(pluginExampleDirectory, 'macos'), + getConfigOnlyDarwinBuildCall( + pluginExampleDirectory, FlutterPlatform.macos), getRunTestCall(pluginExampleDirectory, 'macos', extraFlags: ['-only-testing:RunnerUITests']), ])); @@ -317,6 +335,8 @@ void main() { processRunner.recordedCalls, orderedEquals([ getTargetCheckCall(pluginExampleDirectory, 'ios'), + getConfigOnlyDarwinBuildCall( + pluginExampleDirectory, FlutterPlatform.ios), getRunTestCall(pluginExampleDirectory, 'ios', destination: 'foo_destination'), ])); @@ -354,10 +374,79 @@ void main() { ], null), getTargetCheckCall(pluginExampleDirectory, 'ios'), + getConfigOnlyDarwinBuildCall( + pluginExampleDirectory, FlutterPlatform.ios), getRunTestCall(pluginExampleDirectory, 'ios', destination: 'id=$_simulatorDeviceId'), ])); }); + + group('file filtering', () { + const List files = [ + 'pubspec.yaml', + 'foo.dart', + 'foo.java', + 'foo.kt', + 'foo.m', + 'foo.swift', + 'foo.cc', + 'foo.cpp', + 'foo.h', + ]; + for (final String file in files) { + test('runs command for changes to $file', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +packages/package_a/$file +''')), + ]; + + // The target platform is irrelevant here; because this repo's + // packages are fully federated, there's no need to distinguish + // the ignore list by target (e.g., skipping iOS tests if only Java or + // Kotlin files change), because package-level filering will already + // accomplish the same goal. + final List output = await runCapturingPrint( + runner, ['native-test', '--android']); + + expect( + output, + containsAllInOrder([ + contains('Running for package_a'), + ])); + }); + } + + test('skips commands if all files should be ignored', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +README.md +CODEOWNERS +packages/package_a/CHANGELOG.md +''')), + ]; + + final List output = await runCapturingPrint( + runner, ['native-test', 'android']); + + expect( + output, + isNot(containsAllInOrder([ + contains('Running for package_a'), + ]))); + expect( + output, + containsAllInOrder([ + contains('SKIPPING ALL PACKAGES'), + ])); + }); + }); }); group('macOS', () { @@ -421,6 +510,8 @@ void main() { processRunner.recordedCalls, orderedEquals([ getTargetCheckCall(pluginExampleDirectory, 'macos'), + getConfigOnlyDarwinBuildCall( + pluginExampleDirectory, FlutterPlatform.macos), getRunTestCall(pluginExampleDirectory, 'macos'), ])); }); @@ -1305,6 +1396,8 @@ public class FlutterActivityTest { processRunner.recordedCalls, orderedEquals([ getTargetCheckCall(pluginExampleDirectory, 'macos'), + getConfigOnlyDarwinBuildCall( + pluginExampleDirectory, FlutterPlatform.macos), getRunTestCall(pluginExampleDirectory, 'macos', extraFlags: ['-only-testing:RunnerTests']), ])); @@ -1340,6 +1433,8 @@ public class FlutterActivityTest { processRunner.recordedCalls, orderedEquals([ getTargetCheckCall(pluginExampleDirectory, 'macos'), + getConfigOnlyDarwinBuildCall( + pluginExampleDirectory, FlutterPlatform.macos), getRunTestCall(pluginExampleDirectory, 'macos', extraFlags: ['-only-testing:RunnerUITests']), ])); @@ -1609,9 +1704,13 @@ public class FlutterActivityTest { ], androidFolder.path), getTargetCheckCall(pluginExampleDirectory, 'ios'), + getConfigOnlyDarwinBuildCall( + pluginExampleDirectory, FlutterPlatform.ios), getRunTestCall(pluginExampleDirectory, 'ios', destination: 'foo_destination'), getTargetCheckCall(pluginExampleDirectory, 'macos'), + getConfigOnlyDarwinBuildCall( + pluginExampleDirectory, FlutterPlatform.macos), getRunTestCall(pluginExampleDirectory, 'macos'), ])); }); @@ -1648,6 +1747,8 @@ public class FlutterActivityTest { processRunner.recordedCalls, orderedEquals([ getTargetCheckCall(pluginExampleDirectory, 'macos'), + getConfigOnlyDarwinBuildCall( + pluginExampleDirectory, FlutterPlatform.macos), getRunTestCall(pluginExampleDirectory, 'macos'), ])); }); @@ -1684,6 +1785,8 @@ public class FlutterActivityTest { processRunner.recordedCalls, orderedEquals([ getTargetCheckCall(pluginExampleDirectory, 'ios'), + getConfigOnlyDarwinBuildCall( + pluginExampleDirectory, FlutterPlatform.ios), getRunTestCall(pluginExampleDirectory, 'ios', destination: 'foo_destination'), ])); diff --git a/script/tool/test/xcode_analyze_command_test.dart b/script/tool/test/xcode_analyze_command_test.dart index 7ffac396a59..6342fab97c5 100644 --- a/script/tool/test/xcode_analyze_command_test.dart +++ b/script/tool/test/xcode_analyze_command_test.dart @@ -21,11 +21,12 @@ void main() { late Directory packagesDir; late CommandRunner runner; late RecordingProcessRunner processRunner; + late RecordingProcessRunner gitProcessRunner; setUp(() { mockPlatform = MockPlatform(isMacOS: true); final GitDir gitDir; - (:packagesDir, :processRunner, gitProcessRunner: _, :gitDir) = + (:packagesDir, :processRunner, :gitProcessRunner, :gitDir) = configureBaseCommandMocks(platform: mockPlatform); final XcodeAnalyzeCommand command = XcodeAnalyzeCommand( packagesDir, @@ -561,5 +562,64 @@ void main() { expect(processRunner.recordedCalls, orderedEquals([])); }); }); + + group('file filtering', () { + const List files = [ + 'foo.m', + 'foo.swift', + 'foo.cc', + 'foo.cpp', + 'foo.h', + ]; + for (final String file in files) { + test('runs command for changes to $file', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +packages/package_a/$file +''')), + ]; + + final List output = await runCapturingPrint( + runner, ['xcode-analyze', '--ios']); + + expect( + output, + containsAllInOrder([ + contains('Running for package_a'), + ])); + }); + } + + test('skips commands if all files should be ignored', () async { + createFakePackage('package_a', packagesDir); + + gitProcessRunner.mockProcessesForExecutable['git-diff'] = + [ + FakeProcessInfo(MockProcess(stdout: ''' +README.md +CODEOWNERS +packages/package_a/CHANGELOG.md +packages/package_a/lib/foo.dart +''')), + ]; + + final List output = + await runCapturingPrint(runner, ['xcode-analyze', '--ios']); + + expect( + output, + isNot(containsAllInOrder([ + contains('Running for package_a'), + ]))); + expect( + output, + containsAllInOrder([ + contains('SKIPPING ALL PACKAGES'), + ])); + }); + }); }); } diff --git a/third_party/packages/flutter_svg/CHANGELOG.md b/third_party/packages/flutter_svg/CHANGELOG.md index 0f9dd9ee901..3e58b61b30f 100644 --- a/third_party/packages/flutter_svg/CHANGELOG.md +++ b/third_party/packages/flutter_svg/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.1.0 + +* Exposes `colorMapper` in `SvgPicture` constructors. + ## 2.0.17 * Implement errorBuilder callback diff --git a/third_party/packages/flutter_svg/README.md b/third_party/packages/flutter_svg/README.md index d4d205c3eb0..e25ca450bfa 100644 --- a/third_party/packages/flutter_svg/README.md +++ b/third_party/packages/flutter_svg/README.md @@ -33,6 +33,53 @@ final Widget svgIcon = SvgPicture.asset( ); ``` +For more advanced color manipulation, you can use the `colorMapper` property. +This allows you to define a custom mapping function that will be called for +every color encountered during SVG parsing, enabling you to substitute colors +based on various criteria like the color value itself, the element name, or the +attribute name. + +To use this feature, you need to create a class that extends `ColorMapper` and +override the `substitute` method. + +Here's an example of how to implement a `ColorMapper` to replace specific colors in an SVG: + + +```dart +class _MyColorMapper extends ColorMapper { + const _MyColorMapper(); + + @override + Color substitute( + String? id, + String elementName, + String attributeName, + Color color, + ) { + if (color == const Color(0xFFFF0000)) { + return Colors.blue; + } + if (color == const Color(0xFF00FF00)) { + return Colors.yellow; + } + return color; + } +} +// ··· + const String svgString = ''' + + + + +'''; + final Widget svgIcon = SvgPicture.string( + svgString, + colorMapper: const _MyColorMapper(), + ); +``` + +In this example, all red colors in the SVG will be rendered as blue, and all green colors will be rendered as yellow. You can customize the `substitute` method to implement more complex color mapping logic based on your requirements. + The default placeholder is an empty box (`LimitedBox`) - although if a `height` or `width` is specified on the `SvgPicture`, a `SizedBox` will be used instead (which ensures better layout experience). There is currently no way to show an @@ -67,6 +114,7 @@ If you'd like to render the SVG to some other canvas, you can do something like: ```dart import 'dart:ui' as ui; + // ··· const String rawSvg = '''...'''; final PictureInfo pictureInfo = diff --git a/third_party/packages/flutter_svg/example/lib/readme_excerpts.dart b/third_party/packages/flutter_svg/example/lib/readme_excerpts.dart index fc17e62abe3..7fd7f9132ee 100644 --- a/third_party/packages/flutter_svg/example/lib/readme_excerpts.dart +++ b/third_party/packages/flutter_svg/example/lib/readme_excerpts.dart @@ -7,6 +7,7 @@ // #docregion OutputConversion import 'dart:ui' as ui; + // #enddocregion OutputConversion import 'package:flutter/material.dart'; @@ -101,3 +102,42 @@ Future convertSvgOutput() async { // #enddocregion OutputConversion return image; } + +// #docregion ColorMapper +class _MyColorMapper extends ColorMapper { + const _MyColorMapper(); + + @override + Color substitute( + String? id, + String elementName, + String attributeName, + Color color, + ) { + if (color == const Color(0xFFFF0000)) { + return Colors.blue; + } + if (color == const Color(0xFF00FF00)) { + return Colors.yellow; + } + return color; + } +} +// #enddocregion ColorMapper + +/// Demonstrates loading an SVG asset with a color mapping. +Widget loadWithColorMapper() { + // #docregion ColorMapper + const String svgString = ''' + + + + +'''; + final Widget svgIcon = SvgPicture.string( + svgString, + colorMapper: const _MyColorMapper(), + ); + // #enddocregion ColorMapper + return svgIcon; +} diff --git a/third_party/packages/flutter_svg/lib/svg.dart b/third_party/packages/flutter_svg/lib/svg.dart index 0cb5bb071ee..b1343f47b8e 100644 --- a/third_party/packages/flutter_svg/lib/svg.dart +++ b/third_party/packages/flutter_svg/lib/svg.dart @@ -195,6 +195,7 @@ class SvgPicture extends StatelessWidget { this.clipBehavior = Clip.hardEdge, this.errorBuilder, SvgTheme? theme, + ColorMapper? colorMapper, ui.ColorFilter? colorFilter, @Deprecated('Use colorFilter instead.') ui.Color? color, @Deprecated('Use colorFilter instead.') @@ -205,6 +206,7 @@ class SvgPicture extends StatelessWidget { packageName: package, assetBundle: bundle, theme: theme, + colorMapper: colorMapper, ), colorFilter = colorFilter ?? _getColorFilter(color, colorBlendMode); @@ -261,11 +263,13 @@ class SvgPicture extends StatelessWidget { this.errorBuilder, @Deprecated('This no longer does anything.') bool cacheColorFilter = false, SvgTheme? theme, + ColorMapper? colorMapper, http.Client? httpClient, }) : bytesLoader = SvgNetworkLoader( url, headers: headers, theme: theme, + colorMapper: colorMapper, httpClient: httpClient, ), colorFilter = colorFilter ?? _getColorFilter(color, colorBlendMode); @@ -319,8 +323,13 @@ class SvgPicture extends StatelessWidget { this.clipBehavior = Clip.hardEdge, this.errorBuilder, SvgTheme? theme, + ColorMapper? colorMapper, @Deprecated('This no longer does anything.') bool cacheColorFilter = false, - }) : bytesLoader = SvgFileLoader(file, theme: theme), + }) : bytesLoader = SvgFileLoader( + file, + theme: theme, + colorMapper: colorMapper, + ), colorFilter = colorFilter ?? _getColorFilter(color, colorBlendMode); /// Creates a widget that displays an SVG obtained from a [Uint8List]. @@ -369,8 +378,13 @@ class SvgPicture extends StatelessWidget { this.clipBehavior = Clip.hardEdge, this.errorBuilder, SvgTheme? theme, + ColorMapper? colorMapper, @Deprecated('This no longer does anything.') bool cacheColorFilter = false, - }) : bytesLoader = SvgBytesLoader(bytes, theme: theme), + }) : bytesLoader = SvgBytesLoader( + bytes, + theme: theme, + colorMapper: colorMapper, + ), colorFilter = colorFilter ?? _getColorFilter(color, colorBlendMode); /// Creates a widget that displays an SVG obtained from a [String]. @@ -419,8 +433,13 @@ class SvgPicture extends StatelessWidget { this.clipBehavior = Clip.hardEdge, this.errorBuilder, SvgTheme? theme, + ColorMapper? colorMapper, @Deprecated('This no longer does anything.') bool cacheColorFilter = false, - }) : bytesLoader = SvgStringLoader(string, theme: theme), + }) : bytesLoader = SvgStringLoader( + string, + theme: theme, + colorMapper: colorMapper, + ), colorFilter = colorFilter ?? _getColorFilter(color, colorBlendMode); static ColorFilter? _getColorFilter( diff --git a/third_party/packages/flutter_svg/pubspec.yaml b/third_party/packages/flutter_svg/pubspec.yaml index ca33c7e36d1..b72740d0f68 100644 --- a/third_party/packages/flutter_svg/pubspec.yaml +++ b/third_party/packages/flutter_svg/pubspec.yaml @@ -2,7 +2,7 @@ name: flutter_svg description: An SVG rendering and widget library for Flutter, which allows painting and displaying Scalable Vector Graphics 1.1 files. repository: https://github.com/flutter/packages/tree/main/third_party/packages/flutter_svg issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_svg%22 -version: 2.0.17 +version: 2.1.0 environment: sdk: ^3.4.0 diff --git a/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.asset.color_mapper.png b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.asset.color_mapper.png new file mode 100644 index 00000000000..8af44b8b9f1 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.asset.color_mapper.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.memory.color_mapper.png b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.memory.color_mapper.png new file mode 100644 index 00000000000..8af44b8b9f1 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.memory.color_mapper.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.network.color_mapper.png b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.network.color_mapper.png new file mode 100644 index 00000000000..8af44b8b9f1 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.network.color_mapper.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.color_mapper.png b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.color_mapper.png new file mode 100644 index 00000000000..8af44b8b9f1 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.color_mapper.png differ diff --git a/third_party/packages/flutter_svg/test/widget_svg_test.dart b/third_party/packages/flutter_svg/test/widget_svg_test.dart index 94edb83a1f3..d0f60ad65c7 100644 --- a/third_party/packages/flutter_svg/test/widget_svg_test.dart +++ b/third_party/packages/flutter_svg/test/widget_svg_test.dart @@ -39,6 +39,29 @@ Future _checkWidgetAndGolden(Key key, String filename) async { await expectLater(widgetFinder, matchesGoldenFile('golden_widget/$filename')); } +class _TestColorMapper extends ColorMapper { + const _TestColorMapper(); + + /// Substitutes specific colors for testing the SVG rendering. + @override + Color substitute( + String? id, String elementName, String attributeName, Color color) { + if (color == const Color(0xFF42A5F5)) { + return const Color(0xFF00FF00); // Green + } + if (color == const Color(0xFF0D47A1)) { + return const Color(0xFFFF0000); // Red + } + if (color == const Color(0xFF616161)) { + return const Color(0xFF0000FF); // Blue + } + if (color == const Color(0xFF000000)) { + return const Color(0xFFFFFF00); // Yellow + } + return color; + } +} + void main() { final MediaQueryData mediaQueryData = MediaQueryData.fromView(PlatformDispatcher.instance.implicitView!); @@ -116,6 +139,28 @@ void main() { await _checkWidgetAndGolden(key, 'flutter_logo.string.png'); }); + testWidgets('SvgPicture.string with colorMapper', + (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + MediaQuery( + data: mediaQueryData, + child: RepaintBoundary( + key: key, + child: SvgPicture.string( + svgStr, + width: 100.0, + height: 100.0, + colorMapper: const _TestColorMapper(), + ), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'flutter_logo.string.color_mapper.png'); + }); + testWidgets('SvgPicture natural size', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( @@ -250,6 +295,26 @@ void main() { await _checkWidgetAndGolden(key, 'flutter_logo.memory.png'); }); + testWidgets('SvgPicture.memory with colorMapper', + (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + MediaQuery( + data: mediaQueryData, + child: RepaintBoundary( + key: key, + child: SvgPicture.memory( + svgBytes, + colorMapper: const _TestColorMapper(), + ), + ), + ), + ); + await tester.pumpAndSettle(); + + await _checkWidgetAndGolden(key, 'flutter_logo.memory.color_mapper.png'); + }); + testWidgets('SvgPicture.asset', (WidgetTester tester) async { final FakeAssetBundle fakeAsset = FakeAssetBundle(); final GlobalKey key = GlobalKey(); @@ -269,6 +334,26 @@ void main() { await _checkWidgetAndGolden(key, 'flutter_logo.asset.png'); }); + testWidgets('SvgPicture.asset with colorMapper', (WidgetTester tester) async { + final FakeAssetBundle fakeAsset = FakeAssetBundle(); + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + MediaQuery( + data: mediaQueryData, + child: RepaintBoundary( + key: key, + child: SvgPicture.asset( + 'test.svg', + bundle: fakeAsset, + colorMapper: const _TestColorMapper(), + ), + ), + ), + ); + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'flutter_logo.asset.color_mapper.png'); + }); + testWidgets('SvgPicture.asset DefaultAssetBundle', (WidgetTester tester) async { final FakeAssetBundle fakeAsset = FakeAssetBundle(); @@ -295,6 +380,33 @@ void main() { await _checkWidgetAndGolden(key, 'flutter_logo.asset.png'); }); + testWidgets('SvgPicture.asset DefaultAssetBundle with colorMapper', + (WidgetTester tester) async { + final FakeAssetBundle fakeAsset = FakeAssetBundle(); + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + Directionality( + textDirection: TextDirection.ltr, + child: MediaQuery( + data: mediaQueryData, + child: DefaultAssetBundle( + bundle: fakeAsset, + child: RepaintBoundary( + key: key, + child: SvgPicture.asset( + 'test.svg', + semanticsLabel: 'Test SVG', + colorMapper: const _TestColorMapper(), + ), + ), + ), + ), + ), + ); + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'flutter_logo.asset.color_mapper.png'); + }); + testWidgets('SvgPicture.network', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( @@ -313,6 +425,26 @@ void main() { await _checkWidgetAndGolden(key, 'flutter_logo.network.png'); }); + testWidgets('SvgPicture.network with colorMapper', + (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + MediaQuery( + data: mediaQueryData, + child: RepaintBoundary( + key: key, + child: SvgPicture.network( + 'test.svg', + httpClient: FakeHttpClient(), + colorMapper: const _TestColorMapper(), + ), + ), + ), + ); + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'flutter_logo.network.color_mapper.png'); + }); + testWidgets('SvgPicture.network with headers', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); final FakeHttpClient client = FakeHttpClient();