Back to build
Raw log | Switch to full mode | Login

Downloading Google Java Format... Downloading ktfmt... --packages-for-branch: running on branch "HEAD". Running for all packages, since a file has changed that could affect the entire repository. Formatting .swift files... Running command: "swift-format -i animations/example/ios/Runner/AppDelegate.swift dynamic_layouts/example/ios/Runner/AppDelegate.swift dynamic_layouts/example/macos/Runner/AppDelegate.swift dynamic_layouts/example/macos/Runner/MainFlutterWindow.swift file_selector/file_selector/example/ios/Runner/AppDelegate.swift file_selector/file_selector/example/macos/Runner/AppDelegate.swift file_selector/file_selector/example/macos/Runner/MainFlutterWindow.swift file_selector/file_selector_ios/example/ios/Runner/AppDelegate.swift file_selector/file_selector_macos/example/macos/Runner/AppDelegate.swift file_selector/file_selector_macos/example/macos/Runner/MainFlutterWindow.swift file_selector/file_selector_macos/example/macos/RunnerTests/RunnerTests.swift file_selector/file_selector_macos/macos/Classes/FileSelectorPlugin.swift file_selector/file_selector_macos/macos/Classes/messages.g.swift flutter_adaptive_scaffold/example/ios/Runner/AppDelegate.swift flutter_adaptive_scaffold/example/macos/Runner/AppDelegate.swift flutter_adaptive_scaffold/example/macos/Runner/MainFlutterWindow.swift flutter_image/example/ios/Runner/AppDelegate.swift flutter_image/example/macos/Runner/AppDelegate.swift flutter_image/example/macos/Runner/MainFlutterWindow.swift flutter_markdown/example/ios/Runner/AppDelegate.swift flutter_markdown/example/macos/Runner/AppDelegate.swift flutter_markdown/example/macos/Runner/MainFlutterWindow.swift go_router/example/ios/Runner/AppDelegate.swift go_router/example/macos/Runner/AppDelegate.swift go_router/example/macos/Runner/MainFlutterWindow.swift google_sign_in/google_sign_in/example/macos/Runner/AppDelegate.swift google_sign_in/google_sign_in/example/macos/Runner/MainFlutterWindow.swift google_sign_in/google_sign_in_ios/example/macos/Runner/AppDelegate.swift google_sign_in/google_sign_in_ios/example/macos/Runner/MainFlutterWindow.swift image_picker/image_picker/example/macos/Runner/AppDelegate.swift image_picker/image_picker/example/macos/Runner/MainFlutterWindow.swift image_picker/image_picker_macos/example/macos/Runner/AppDelegate.swift image_picker/image_picker_macos/example/macos/Runner/MainFlutterWindow.swift in_app_purchase/in_app_purchase/example/macos/Runner/AppDelegate.swift in_app_purchase/in_app_purchase/example/macos/Runner/MainFlutterWindow.swift in_app_purchase/in_app_purchase_storekit/example/macos/Runner/AppDelegate.swift in_app_purchase/in_app_purchase_storekit/example/macos/Runner/MainFlutterWindow.swift ios_platform_images/example/ios/Runner/AppDelegate.swift ios_platform_images/example/ios/RunnerTests/IosPlatformImagesTests.swift ios_platform_images/ios/Classes/IosPlatformImagesPlugin.swift ios_platform_images/ios/Classes/UIImageIosPlatformImages.swift ios_platform_images/ios/Classes/messages.g.swift palette_generator/example/ios/Runner/AppDelegate.swift palette_generator/example/macos/Runner/AppDelegate.swift palette_generator/example/macos/Runner/MainFlutterWindow.swift path_provider/path_provider/example/macos/Runner/AppDelegate.swift path_provider/path_provider/example/macos/Runner/MainFlutterWindow.swift path_provider/path_provider_foundation/darwin/Classes/PathProviderPlugin.swift path_provider/path_provider_foundation/darwin/Classes/messages.g.swift path_provider/path_provider_foundation/darwin/RunnerTests/RunnerTests.swift path_provider/path_provider_foundation/example/ios/Runner/AppDelegate.swift path_provider/path_provider_foundation/example/macos/Runner/AppDelegate.swift path_provider/path_provider_foundation/example/macos/Runner/MainFlutterWindow.swift pigeon/example/app/ios/Runner/AppDelegate.swift pigeon/example/app/ios/Runner/Messages.g.swift pigeon/example/app/macos/Runner/AppDelegate.swift pigeon/example/app/macos/Runner/MainFlutterWindow.swift pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner/AppDelegate.swift pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner/MainFlutterWindow.swift pigeon/platform_tests/alternate_language_test_plugin/example/macos/RunnerTests/RunnerTests.swift pigeon/platform_tests/test_plugin/example/ios/Runner/AppDelegate.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AsyncHandlersTest.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EchoBinaryMessenger.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EnumTests.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/HandlerBinaryMessenger.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/ListTests.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MockBinaryMessenger.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MultipleArityTests.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NSNullFieldTests.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NonNullFieldsTest.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NullableReturnsTests.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/PrimitiveTests.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/RunnerTests.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/Utils.swift pigeon/platform_tests/test_plugin/example/macos/Runner/AppDelegate.swift pigeon/platform_tests/test_plugin/example/macos/Runner/MainFlutterWindow.swift pigeon/platform_tests/test_plugin/example/macos/RunnerTests/BasicCompileTest.swift pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift platform/example/ios/Runner/AppDelegate.swift platform/example/macos/Runner/AppDelegate.swift platform/example/macos/Runner/MainFlutterWindow.swift pointer_interceptor/pointer_interceptor/example/ios/Runner/AppDelegate.swift pointer_interceptor/pointer_interceptor/example/ios/Runner/DummyPlatformViewFactory.swift pointer_interceptor/pointer_interceptor_ios/example/ios/Runner/AppDelegate.swift pointer_interceptor/pointer_interceptor_ios/example/ios/Runner/DummyPlatformViewFactory.swift pointer_interceptor/pointer_interceptor_ios/example/ios/RunnerTests/RunnerTests.swift pointer_interceptor/pointer_interceptor_ios/example/ios/RunnerUITests/RunnerUITests.swift pointer_interceptor/pointer_interceptor_ios/ios/Classes/PointerInterceptorFactory.swift pointer_interceptor/pointer_interceptor_ios/ios/Classes/PointerInterceptorIosPlugin.swift pointer_interceptor/pointer_interceptor_ios/ios/Classes/PointerInterceptorView.swift quick_actions/quick_actions_ios/example/ios/RunnerTests/Mocks/MockShortcutItemProvider.swift quick_actions/quick_actions_ios/example/ios/RunnerTests/QuickActionsPluginTests.swift quick_actions/quick_actions_ios/example/ios/RunnerUITests/RunnerUITests.swift quick_actions/quick_actions_ios/ios/Classes/QuickActionsPlugin.swift quick_actions/quick_actions_ios/ios/Classes/ShortcutItemProviding.swift quick_actions/quick_actions_ios/ios/Classes/messages.g.swift rfw/example/hello/ios/Runner/AppDelegate.swift rfw/example/hello/macos/Runner/AppDelegate.swift rfw/example/hello/macos/Runner/MainFlutterWindow.swift rfw/example/local/ios/Runner/AppDelegate.swift rfw/example/local/macos/Runner/AppDelegate.swift rfw/example/local/macos/Runner/MainFlutterWindow.swift rfw/example/remote/ios/Runner/AppDelegate.swift rfw/example/remote/macos/Runner/AppDelegate.swift rfw/example/remote/macos/Runner/MainFlutterWindow.swift rfw/example/wasm/macos/Runner/AppDelegate.swift rfw/example/wasm/macos/Runner/MainFlutterWindow.swift shared_preferences/shared_preferences/example/ios/Runner/AppDelegate.swift shared_preferences/shared_preferences/example/macos/Runner/AppDelegate.swift shared_preferences/shared_preferences/example/macos/Runner/MainFlutterWindow.swift shared_preferences/shared_preferences_foundation/darwin/Classes/SharedPreferencesPlugin.swift shared_preferences/shared_preferences_foundation/darwin/Classes/messages.g.swift shared_preferences/shared_preferences_foundation/darwin/Tests/RunnerTests.swift shared_preferences/shared_preferences_foundation/example/ios/Runner/AppDelegate.swift shared_preferences/shared_preferences_foundation/example/macos/Runner/AppDelegate.swift shared_preferences/shared_preferences_foundation/example/macos/Runner/MainFlutterWindow.swift two_dimensional_scrollables/example/ios/Runner/AppDelegate.swift two_dimensional_scrollables/example/ios/RunnerTests/RunnerTests.swift two_dimensional_scrollables/example/macos/Runner/AppDelegate.swift two_dimensional_scrollables/example/macos/Runner/MainFlutterWindow.swift two_dimensional_scrollables/example/macos/RunnerTests/RunnerTests.swift url_launcher/url_launcher/example/macos/Runner/AppDelegate.swift url_launcher/url_launcher/example/macos/Runner/MainFlutterWindow.swift url_launcher/url_launcher_ios/example/ios/RunnerTests/URLLauncherTests.swift url_launcher/url_launcher_ios/example/ios/RunnerUITests/URLLauncherUITests.swift url_launcher/url_launcher_ios/ios/Classes/Launcher.swift url_launcher/url_launcher_ios/ios/Classes/URLLaunchSession.swift url_launcher/url_launcher_ios/ios/Classes/URLLauncherPlugin.swift url_launcher/url_launcher_ios/ios/Classes/messages.g.swift url_launcher/url_launcher_macos/example/macos/Runner/AppDelegate.swift url_launcher/url_launcher_macos/example/macos/Runner/MainFlutterWindow.swift url_launcher/url_launcher_macos/example/macos/RunnerTests/RunnerTests.swift url_launcher/url_launcher_macos/macos/Classes/UrlLauncherPlugin.swift url_launcher/url_launcher_macos/macos/Classes/messages.g.swift video_player/video_player/example/macos/Runner/AppDelegate.swift video_player/video_player/example/macos/Runner/MainFlutterWindow.swift video_player/video_player_avfoundation/example/macos/Runner/AppDelegate.swift video_player/video_player_avfoundation/example/macos/Runner/MainFlutterWindow.swift" in /Volumes/Work/s/w/ir/x/w/packages/packages These files are not formatted correctly (see diff below): animations/example/ios/Runner/AppDelegate.swift dynamic_layouts/example/ios/Runner/AppDelegate.swift file_selector/file_selector/example/ios/Runner/AppDelegate.swift file_selector/file_selector_ios/example/ios/Runner/AppDelegate.swift flutter_adaptive_scaffold/example/ios/Runner/AppDelegate.swift flutter_image/example/ios/Runner/AppDelegate.swift flutter_markdown/example/ios/Runner/AppDelegate.swift go_router/example/ios/Runner/AppDelegate.swift palette_generator/example/ios/Runner/AppDelegate.swift path_provider/path_provider_foundation/darwin/Classes/PathProviderPlugin.swift path_provider/path_provider_foundation/darwin/RunnerTests/RunnerTests.swift path_provider/path_provider_foundation/example/ios/Runner/AppDelegate.swift pigeon/example/app/ios/Runner/AppDelegate.swift pigeon/example/app/ios/Runner/Messages.g.swift pigeon/platform_tests/alternate_language_test_plugin/example/macos/RunnerTests/RunnerTests.swift pigeon/platform_tests/test_plugin/example/ios/Runner/AppDelegate.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AsyncHandlersTest.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EchoBinaryMessenger.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EnumTests.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/HandlerBinaryMessenger.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/ListTests.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MockBinaryMessenger.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MultipleArityTests.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NSNullFieldTests.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NonNullFieldsTest.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NullableReturnsTests.swift pigeon/platform_tests/test_plugin/example/ios/RunnerTests/PrimitiveTests.swift pigeon/platform_tests/test_plugin/example/macos/RunnerTests/BasicCompileTest.swift pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift platform/example/ios/Runner/AppDelegate.swift pointer_interceptor/pointer_interceptor/example/ios/Runner/AppDelegate.swift pointer_interceptor/pointer_interceptor/example/ios/Runner/DummyPlatformViewFactory.swift pointer_interceptor/pointer_interceptor_ios/example/ios/Runner/AppDelegate.swift pointer_interceptor/pointer_interceptor_ios/example/ios/Runner/DummyPlatformViewFactory.swift quick_actions/quick_actions_ios/example/ios/RunnerUITests/RunnerUITests.swift quick_actions/quick_actions_ios/ios/Classes/messages.g.swift rfw/example/hello/ios/Runner/AppDelegate.swift rfw/example/local/ios/Runner/AppDelegate.swift rfw/example/remote/ios/Runner/AppDelegate.swift shared_preferences/shared_preferences/example/ios/Runner/AppDelegate.swift shared_preferences/shared_preferences_foundation/darwin/Classes/SharedPreferencesPlugin.swift shared_preferences/shared_preferences_foundation/darwin/Tests/RunnerTests.swift shared_preferences/shared_preferences_foundation/example/ios/Runner/AppDelegate.swift two_dimensional_scrollables/example/ios/Runner/AppDelegate.swift two_dimensional_scrollables/example/macos/RunnerTests/RunnerTests.swift To fix run the repository tooling `format` command: https://github.com/flutter/packages/blob/main/script/tool/README.md#format-code or copy-paste this command into your terminal: patch -p1 <<DONE diff --git a/packages/animations/example/ios/Runner/AppDelegate.swift b/packages/animations/example/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/animations/example/ios/Runner/AppDelegate.swift +++ b/packages/animations/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/dynamic_layouts/example/ios/Runner/AppDelegate.swift b/packages/dynamic_layouts/example/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/dynamic_layouts/example/ios/Runner/AppDelegate.swift +++ b/packages/dynamic_layouts/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/file_selector/file_selector/example/ios/Runner/AppDelegate.swift b/packages/file_selector/file_selector/example/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/file_selector/file_selector/example/ios/Runner/AppDelegate.swift +++ b/packages/file_selector/file_selector/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/file_selector/file_selector_ios/example/ios/Runner/AppDelegate.swift b/packages/file_selector/file_selector_ios/example/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/file_selector/file_selector_ios/example/ios/Runner/AppDelegate.swift +++ b/packages/file_selector/file_selector_ios/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/flutter_adaptive_scaffold/example/ios/Runner/AppDelegate.swift b/packages/flutter_adaptive_scaffold/example/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/flutter_adaptive_scaffold/example/ios/Runner/AppDelegate.swift +++ b/packages/flutter_adaptive_scaffold/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/flutter_image/example/ios/Runner/AppDelegate.swift b/packages/flutter_image/example/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/flutter_image/example/ios/Runner/AppDelegate.swift +++ b/packages/flutter_image/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/flutter_markdown/example/ios/Runner/AppDelegate.swift b/packages/flutter_markdown/example/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/flutter_markdown/example/ios/Runner/AppDelegate.swift +++ b/packages/flutter_markdown/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/go_router/example/ios/Runner/AppDelegate.swift b/packages/go_router/example/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/go_router/example/ios/Runner/AppDelegate.swift +++ b/packages/go_router/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/palette_generator/example/ios/Runner/AppDelegate.swift b/packages/palette_generator/example/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/palette_generator/example/ios/Runner/AppDelegate.swift +++ b/packages/palette_generator/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/path_provider/path_provider_foundation/darwin/Classes/PathProviderPlugin.swift b/packages/path_provider/path_provider_foundation/darwin/Classes/PathProviderPlugin.swift index 5530b8be0..16f2edb84 100644 --- a/packages/path_provider/path_provider_foundation/darwin/Classes/PathProviderPlugin.swift +++ b/packages/path_provider/path_provider_foundation/darwin/Classes/PathProviderPlugin.swift @@ -5,62 +5,63 @@ import Foundation #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #endif public class PathProviderPlugin: NSObject, FlutterPlugin, PathProviderApi { public static func register(with registrar: FlutterPluginRegistrar) { let instance = PathProviderPlugin() // Workaround for https://github.com/flutter/flutter/issues/118103. -#if os(iOS) - let messenger = registrar.messenger() -#else - let messenger = registrar.messenger -#endif + #if os(iOS) + let messenger = registrar.messenger() + #else + let messenger = registrar.messenger + #endif PathProviderApiSetup.setUp(binaryMessenger: messenger, api: instance) } func getDirectoryPath(type: DirectoryType) -> String? { var path = getDirectory(ofType: fileManagerDirectoryForType(type)) - #if os(macOS) - // In a non-sandboxed app, these are shared directories where applications are - // expected to use its bundle ID as a subdirectory. (For non-sandboxed apps, - // adding the extra path is harmless). - // This is not done for iOS, for compatibility with older versions of the - // plugin. - if type == .applicationSupport || type == .applicationCache { - if let basePath = path { - let basePathURL = URL.init(fileURLWithPath: basePath) - path = basePathURL.appendingPathComponent(Bundle.main.bundleIdentifier!).path + #if os(macOS) + // In a non-sandboxed app, these are shared directories where applications are + // expected to use its bundle ID as a subdirectory. (For non-sandboxed apps, + // adding the extra path is harmless). + // This is not done for iOS, for compatibility with older versions of the + // plugin. + if type == .applicationSupport || type == .applicationCache { + if let basePath = path { + let basePathURL = URL.init(fileURLWithPath: basePath) + path = basePathURL.appendingPathComponent(Bundle.main.bundleIdentifier!).path + } } - } - #endif + #endif return path } // Returns the path for the container of the specified app group. func getContainerPath(appGroupIdentifier: String) -> String? { - return FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupIdentifier)?.path + return FileManager.default.containerURL( + forSecurityApplicationGroupIdentifier: appGroupIdentifier)?.path } } /// Returns the FileManager constant corresponding to the given type. private func fileManagerDirectoryForType(_ type: DirectoryType) -> FileManager.SearchPathDirectory { switch type { - case .applicationCache: - return FileManager.SearchPathDirectory.cachesDirectory - case .applicationDocuments: - return FileManager.SearchPathDirectory.documentDirectory - case .applicationSupport: - return FileManager.SearchPathDirectory.applicationSupportDirectory - case .downloads: - return FileManager.SearchPathDirectory.downloadsDirectory - case .library: - return FileManager.SearchPathDirectory.libraryDirectory - case .temp: - return FileManager.SearchPathDirectory.cachesDirectory + case .applicationCache: + return FileManager.SearchPathDirectory.cachesDirectory + case .applicationDocuments: + return FileManager.SearchPathDirectory.documentDirectory + case .applicationSupport: + return FileManager.SearchPathDirectory.applicationSupportDirectory + case .downloads: + return FileManager.SearchPathDirectory.downloadsDirectory + case .library: + return FileManager.SearchPathDirectory.libraryDirectory + case .temp: + return FileManager.SearchPathDirectory.cachesDirectory } } diff --git a/packages/path_provider/path_provider_foundation/darwin/RunnerTests/RunnerTests.swift b/packages/path_provider/path_provider_foundation/darwin/RunnerTests/RunnerTests.swift index 99a56f2bf..67ee98167 100644 --- a/packages/path_provider/path_provider_foundation/darwin/RunnerTests/RunnerTests.swift +++ b/packages/path_provider/path_provider_foundation/darwin/RunnerTests/RunnerTests.swift @@ -3,12 +3,13 @@ // found in the LICENSE file. import XCTest + @testable import path_provider_foundation #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #endif class RunnerTests: XCTestCase { @@ -39,28 +40,28 @@ class RunnerTests: XCTestCase { func testGetApplicationSupportDirectory() throws { let plugin = PathProviderPlugin() let path = plugin.getDirectoryPath(type: .applicationSupport) -#if os(iOS) - // On iOS, the application support directory path should be just the system application - // support path. - XCTAssertEqual( - path, - NSSearchPathForDirectoriesInDomains( - FileManager.SearchPathDirectory.applicationSupportDirectory, - FileManager.SearchPathDomainMask.userDomainMask, - true - ).first) -#else - // On macOS, the application support directory path should be the system application - // support path with an added subdirectory based on the app name. - XCTAssert( - path!.hasPrefix( + #if os(iOS) + // On iOS, the application support directory path should be just the system application + // support path. + XCTAssertEqual( + path, NSSearchPathForDirectoriesInDomains( FileManager.SearchPathDirectory.applicationSupportDirectory, FileManager.SearchPathDomainMask.userDomainMask, true - ).first!)) - XCTAssert(path!.hasSuffix("Example")) -#endif + ).first) + #else + // On macOS, the application support directory path should be the system application + // support path with an added subdirectory based on the app name. + XCTAssert( + path!.hasPrefix( + NSSearchPathForDirectoriesInDomains( + FileManager.SearchPathDirectory.applicationSupportDirectory, + FileManager.SearchPathDomainMask.userDomainMask, + true + ).first!)) + XCTAssert(path!.hasSuffix("Example")) + #endif } func testGetLibraryDirectory() throws { diff --git a/packages/path_provider/path_provider_foundation/example/ios/Runner/AppDelegate.swift b/packages/path_provider/path_provider_foundation/example/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/path_provider/path_provider_foundation/example/ios/Runner/AppDelegate.swift +++ b/packages/path_provider/path_provider_foundation/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/pigeon/example/app/ios/Runner/AppDelegate.swift b/packages/pigeon/example/app/ios/Runner/AppDelegate.swift index 3c7913122..f259b7590 100644 --- a/packages/pigeon/example/app/ios/Runner/AppDelegate.swift +++ b/packages/pigeon/example/app/ios/Runner/AppDelegate.swift @@ -15,14 +15,14 @@ private class PigeonApiImplementation: ExampleHostApi { } func add(_ a: Int64, to b: Int64) throws -> Int64 { - if (a < 0 || b < 0) { - throw FlutterError(code: "code", message: "message", details: "details"); + if a < 0 || b < 0 { + throw FlutterError(code: "code", message: "message", details: "details") } return a + b } func sendMessage(message: MessageData, completion: @escaping (Result<Bool, Error>) -> Void) { - if (message.code == Code.one) { + if message.code == Code.one { completion(.failure(FlutterError(code: "code", message: "message", details: "details"))) return } @@ -39,7 +39,9 @@ private class PigeonFlutterApi { flutterAPI = MessageFlutterApi(binaryMessenger: binaryMessenger) } - func callFlutterMethod(aString aStringArg: String?, completion: @escaping (Result<String, Error>) -> Void) { + func callFlutterMethod( + aString aStringArg: String?, completion: @escaping (Result<String, Error>) -> Void + ) { flutterAPI.flutterMethod(aString: aStringArg) { completion(.success($0)) } diff --git a/packages/pigeon/example/app/ios/Runner/Messages.g.swift b/packages/pigeon/example/app/ios/Runner/Messages.g.swift index ad6a337a6..3acc38b2c 100644 --- a/packages/pigeon/example/app/ios/Runner/Messages.g.swift +++ b/packages/pigeon/example/app/ios/Runner/Messages.g.swift @@ -5,12 +5,13 @@ // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif private func wrapResult(_ result: Any?) -> [Any?] { @@ -22,18 +23,20 @@ private func wrapError(_ error: Any) -> [Any?] { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } private func createConnectionError(withChannelName channelName: String) -> FlutterError { - return FlutterError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") + return FlutterError( + code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", + details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -83,10 +86,10 @@ struct MessageData { private class ExampleHostApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return MessageData.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return MessageData.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -129,7 +132,9 @@ class ExampleHostApiSetup { static var codec: FlutterStandardMessageCodec { ExampleHostApiCodec.shared } /// Sets up an instance of `ExampleHostApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: ExampleHostApi?) { - let getHostLanguageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.getHostLanguage", binaryMessenger: binaryMessenger, codec: codec) + let getHostLanguageChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.getHostLanguage", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getHostLanguageChannel.setMessageHandler { _, reply in do { @@ -142,7 +147,9 @@ class ExampleHostApiSetup { } else { getHostLanguageChannel.setMessageHandler(nil) } - let addChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.add", binaryMessenger: binaryMessenger, codec: codec) + let addChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.add", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { addChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -158,17 +165,19 @@ class ExampleHostApiSetup { } else { addChannel.setMessageHandler(nil) } - let sendMessageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.sendMessage", binaryMessenger: binaryMessenger, codec: codec) + let sendMessageChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.sendMessage", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { sendMessageChannel.setMessageHandler { message, reply in let args = message as! [Any?] let messageArg = args[0] as! MessageData api.sendMessage(message: messageArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -179,28 +188,36 @@ class ExampleHostApiSetup { } /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol MessageFlutterApiProtocol { - func flutterMethod(aString aStringArg: String?, completion: @escaping (Result<String, FlutterError>) -> Void) + func flutterMethod( + aString aStringArg: String?, completion: @escaping (Result<String, FlutterError>) -> Void) } class MessageFlutterApi: MessageFlutterApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } - func flutterMethod(aString aStringArg: String?, completion: @escaping (Result<String, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_example_package.MessageFlutterApi.flutterMethod" + func flutterMethod( + aString aStringArg: String?, completion: @escaping (Result<String, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_example_package.MessageFlutterApi.flutterMethod" let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/RunnerTests/RunnerTests.swift b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/RunnerTests/RunnerTests.swift index e332af122..46e5239c5 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/RunnerTests/RunnerTests.swift +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/RunnerTests/RunnerTests.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import FlutterMacOS import Cocoa +import FlutterMacOS import XCTest @testable import alternate_language_test_plugin diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/Runner/AppDelegate.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/Runner/AppDelegate.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift index ed6b53459..7e7266940 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift @@ -4,6 +4,7 @@ import Flutter import XCTest + @testable import test_plugin class AllDatatypesTests: XCTestCase { @@ -17,25 +18,25 @@ class AllDatatypesTests: XCTestCase { api.echoNullable(everything) { result in switch result { - case .success(let res) : - XCTAssertNotNil(res) - XCTAssertNil(res!.aNullableBool) - XCTAssertNil(res!.aNullableInt) - XCTAssertNil(res!.aNullableDouble) - XCTAssertNil(res!.aNullableString) - XCTAssertNil(res!.aNullableByteArray) - XCTAssertNil(res!.aNullable4ByteArray) - XCTAssertNil(res!.aNullable8ByteArray) - XCTAssertNil(res!.aNullableFloatArray) - XCTAssertNil(res!.aNullableList) - XCTAssertNil(res!.aNullableMap) - XCTAssertNil(res!.nullableNestedList) - XCTAssertNil(res!.nullableMapWithAnnotations) - XCTAssertNil(res!.nullableMapWithObject) - expectation.fulfill() - case .failure(_) : - return - + case .success(let res): + XCTAssertNotNil(res) + XCTAssertNil(res!.aNullableBool) + XCTAssertNil(res!.aNullableInt) + XCTAssertNil(res!.aNullableDouble) + XCTAssertNil(res!.aNullableString) + XCTAssertNil(res!.aNullableByteArray) + XCTAssertNil(res!.aNullable4ByteArray) + XCTAssertNil(res!.aNullable8ByteArray) + XCTAssertNil(res!.aNullableFloatArray) + XCTAssertNil(res!.aNullableList) + XCTAssertNil(res!.aNullableMap) + XCTAssertNil(res!.nullableNestedList) + XCTAssertNil(res!.nullableMapWithAnnotations) + XCTAssertNil(res!.nullableMapWithObject) + expectation.fulfill() + case .failure(_): + return + } } @@ -55,36 +56,36 @@ class AllDatatypesTests: XCTestCase { aNullableMap: ["hello": 1234], nullableNestedList: [[true, false], [true]], nullableMapWithAnnotations: ["hello": "world"], - nullableMapWithObject: ["hello": 1234, "goodbye" : "world"], + nullableMapWithObject: ["hello": 1234, "goodbye": "world"], aNullableString: "123" ) - + let binaryMessenger = EchoBinaryMessenger(codec: FlutterIntegrationCoreApiCodec.shared) let api = FlutterIntegrationCoreApi(binaryMessenger: binaryMessenger) let expectation = XCTestExpectation(description: "callback") api.echoNullable(everything) { result in - switch result { - case .success(let res) : - XCTAssertNotNil(res) - XCTAssertEqual(res!.aNullableBool, everything.aNullableBool) - XCTAssertEqual(res!.aNullableInt, everything.aNullableInt) - XCTAssertEqual(res!.aNullableDouble, everything.aNullableDouble) - XCTAssertEqual(res!.aNullableString, everything.aNullableString) - XCTAssertEqual(res!.aNullableByteArray, everything.aNullableByteArray) - XCTAssertEqual(res!.aNullable4ByteArray, everything.aNullable4ByteArray) - XCTAssertEqual(res!.aNullable8ByteArray, everything.aNullable8ByteArray) - XCTAssertEqual(res!.aNullableFloatArray, everything.aNullableFloatArray) - XCTAssert(equalsList(res!.aNullableList, everything.aNullableList)) - XCTAssert(equalsDictionary(res!.aNullableMap, everything.aNullableMap)) - XCTAssertEqual(res!.nullableNestedList, everything.nullableNestedList) - XCTAssertEqual(res!.nullableMapWithAnnotations, everything.nullableMapWithAnnotations) - XCTAssert(equalsDictionary(res!.nullableMapWithObject, everything.nullableMapWithObject)) - expectation.fulfill() - return - case .failure(_) : - return + switch result { + case .success(let res): + XCTAssertNotNil(res) + XCTAssertEqual(res!.aNullableBool, everything.aNullableBool) + XCTAssertEqual(res!.aNullableInt, everything.aNullableInt) + XCTAssertEqual(res!.aNullableDouble, everything.aNullableDouble) + XCTAssertEqual(res!.aNullableString, everything.aNullableString) + XCTAssertEqual(res!.aNullableByteArray, everything.aNullableByteArray) + XCTAssertEqual(res!.aNullable4ByteArray, everything.aNullable4ByteArray) + XCTAssertEqual(res!.aNullable8ByteArray, everything.aNullable8ByteArray) + XCTAssertEqual(res!.aNullableFloatArray, everything.aNullableFloatArray) + XCTAssert(equalsList(res!.aNullableList, everything.aNullableList)) + XCTAssert(equalsDictionary(res!.aNullableMap, everything.aNullableMap)) + XCTAssertEqual(res!.nullableNestedList, everything.nullableNestedList) + XCTAssertEqual(res!.nullableMapWithAnnotations, everything.nullableMapWithAnnotations) + XCTAssert(equalsDictionary(res!.nullableMapWithObject, everything.nullableMapWithObject)) + expectation.fulfill() + return + case .failure(_): + return } } wait(for: [expectation], timeout: 1.0) diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AsyncHandlersTest.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AsyncHandlersTest.swift index f5852c47a..f7e8db596 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AsyncHandlersTest.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AsyncHandlersTest.swift @@ -3,6 +3,7 @@ // found in the LICENSE file. import Flutter import XCTest + @testable import test_plugin class MockHostSmallApi: HostSmallApi { @@ -27,12 +28,12 @@ class AsyncHandlersTest: XCTestCase { let expectation = XCTestExpectation(description: "callback") flutterApi.echo(value) { result in - switch result { - case .success(let res) : - XCTAssertEqual(res, value) - expectation.fulfill() - case .failure(_) : - return + switch result { + case .success(let res): + XCTAssertEqual(res, value) + expectation.fulfill() + case .failure(_): + return } } @@ -40,7 +41,8 @@ class AsyncHandlersTest: XCTestCase { } func testAsyncFlutter2HostVoidVoid() throws { - let binaryMessenger = MockBinaryMessenger<String>(codec: FlutterStandardMessageCodec.sharedInstance()) + let binaryMessenger = MockBinaryMessenger<String>( + codec: FlutterStandardMessageCodec.sharedInstance()) let mockHostSmallApi = MockHostSmallApi() HostSmallApiSetup.setUp(binaryMessenger: binaryMessenger, api: mockHostSmallApi) let channelName = "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid" @@ -49,14 +51,15 @@ class AsyncHandlersTest: XCTestCase { let expectation = XCTestExpectation(description: "voidvoid callback") binaryMessenger.handlers[channelName]?(nil) { data in let outputList = binaryMessenger.codec.decode(data) as? [Any] - XCTAssertEqual(outputList?.first as! NSNull, NSNull()) + XCTAssertEqual(outputList?.first as! NSNull, NSNull()) expectation.fulfill() } wait(for: [expectation], timeout: 1.0) } func testAsyncFlutter2Host() throws { - let binaryMessenger = MockBinaryMessenger<String>(codec: FlutterStandardMessageCodec.sharedInstance()) + let binaryMessenger = MockBinaryMessenger<String>( + codec: FlutterStandardMessageCodec.sharedInstance()) let mockHostSmallApi = MockHostSmallApi() let value = "Test" mockHostSmallApi.output = value @@ -69,7 +72,7 @@ class AsyncHandlersTest: XCTestCase { let expectation = XCTestExpectation(description: "echo callback") binaryMessenger.handlers[channelName]?(inputEncoded) { data in let outputList = binaryMessenger.codec.decode(data) as? [Any] - let output = outputList?.first as? String + let output = outputList?.first as? String XCTAssertEqual(output, value) expectation.fulfill() } diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EchoBinaryMessenger.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EchoBinaryMessenger.swift index a2f524c2b..26c4de6ea 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EchoBinaryMessenger.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EchoBinaryMessenger.swift @@ -2,30 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import Foundation import Flutter +import Foundation class EchoBinaryMessenger: NSObject, FlutterBinaryMessenger { let codec: FlutterMessageCodec private(set) var count = 0 var defaultReturn: Any? - + init(codec: FlutterMessageCodec) { self.codec = codec super.init() } - + func send(onChannel channel: String, message: Data?) { // Method not implemented because this messenger is just for echoing } - + func send( onChannel channel: String, message: Data?, binaryReply callback: FlutterBinaryReply? = nil ) { guard let callback = callback else { return } - + guard let args = self.codec.decode(message) as? [Any?], let firstArg = args.first, @@ -34,20 +34,21 @@ class EchoBinaryMessenger: NSObject, FlutterBinaryMessenger { callback(self.defaultReturn.flatMap { self.codec.encode([$0]) }) return } - + callback(self.codec.encode([castedFirstArg])) } - + func setMessageHandlerOnChannel( - _ channel: String, binaryMessageHandler handler: - FlutterBinaryMessageHandler? = nil + _ channel: String, + binaryMessageHandler handler: + FlutterBinaryMessageHandler? = nil ) -> FlutterBinaryMessengerConnection { self.count += 1 return FlutterBinaryMessengerConnection(self.count) } - + func cleanUpConnection(_ connection: FlutterBinaryMessengerConnection) { - // Method not implemented because this messenger is just for echoing + // Method not implemented because this messenger is just for echoing } private func nilOrValue<T>(_ value: Any?) -> T? { diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EnumTests.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EnumTests.swift index 2c8c0cc41..391ace5d9 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EnumTests.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EnumTests.swift @@ -3,6 +3,7 @@ // found in the LICENSE file. import XCTest + @testable import test_plugin class MockEnumApi2Host: EnumApi2Host { @@ -32,7 +33,7 @@ class EnumTests: XCTestCase { binaryMessenger.handlers[channelName]?(inputEncoded) { data in let outputMap = binaryMessenger.codec.decode(data) as? [Any] XCTAssertNotNil(outputMap) - + let output = outputMap?.first as? DataWithEnum XCTAssertEqual(output, input) XCTAssertTrue(outputMap?.count == 1) @@ -49,11 +50,11 @@ class EnumTests: XCTestCase { let expectation = XCTestExpectation(description: "callback") api.echo(data: data) { result in switch result { - case .success(let res) : - XCTAssertEqual(res.state, res.state) - expectation.fulfill() - case .failure(_) : - return + case .success(let res): + XCTAssertEqual(res.state, res.state) + expectation.fulfill() + case .failure(_): + return } } wait(for: [expectation], timeout: 1.0) diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/HandlerBinaryMessenger.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/HandlerBinaryMessenger.swift index fda20a40d..7bd4394f9 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/HandlerBinaryMessenger.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/HandlerBinaryMessenger.swift @@ -2,42 +2,42 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import Foundation import Flutter +import Foundation -typealias HandlerBinaryMessengerHandler = ([Any?])-> Any +typealias HandlerBinaryMessengerHandler = ([Any?]) -> Any class HandlerBinaryMessenger: NSObject, FlutterBinaryMessenger { let codec: FlutterMessageCodec let handler: HandlerBinaryMessengerHandler private var count = 0 - + init(codec: FlutterMessageCodec, handler: @escaping HandlerBinaryMessengerHandler) { self.codec = codec self.handler = handler super.init() } - + func send(onChannel channel: String, message: Data?) { // Method not implemented because this messenger is just for handling } - + func send( onChannel channel: String, message: Data?, binaryReply callback: FlutterBinaryReply? = nil ) { guard let callback = callback else { return } - + guard let args = self.codec.decode(message) as? [Any?] else { callback(nil) return } - + let result = self.handler(args) callback(self.codec.encode([result])) } - + func setMessageHandlerOnChannel( _ channel: String, binaryMessageHandler handler: FlutterBinaryMessageHandler? = nil @@ -45,7 +45,7 @@ class HandlerBinaryMessenger: NSObject, FlutterBinaryMessenger { self.count += 1 return FlutterBinaryMessengerConnection(self.count) } - + func cleanUpConnection(_ connection: FlutterBinaryMessengerConnection) { // Method not implemented because this messenger is just for handling } diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/ListTests.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/ListTests.swift index b096ed2bc..4fc7de6b9 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/ListTests.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/ListTests.swift @@ -3,6 +3,7 @@ // found in the LICENSE file. import XCTest + @testable import test_plugin class ListTests: XCTestCase { @@ -16,13 +17,13 @@ class ListTests: XCTestCase { let expectation = XCTestExpectation(description: "callback") api.echo(top) { result in switch result { - case .success(let res) : - XCTAssertEqual(1, res.testList?.count) - XCTAssertTrue(res.testList?[0] is TestMessage) - XCTAssert(equalsList(inside.testList, (res.testList?[0] as! TestMessage).testList)) - expectation.fulfill() - case .failure(_) : - return + case .success(let res): + XCTAssertEqual(1, res.testList?.count) + XCTAssertTrue(res.testList?[0] is TestMessage) + XCTAssert(equalsList(inside.testList, (res.testList?[0] as! TestMessage).testList)) + expectation.fulfill() + case .failure(_): + return } } wait(for: [expectation], timeout: 1.0) diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MockBinaryMessenger.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MockBinaryMessenger.swift index 9f7f9483b..23aa9d5b5 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MockBinaryMessenger.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MockBinaryMessenger.swift @@ -3,6 +3,7 @@ // found in the LICENSE file. import Flutter + @testable import test_plugin class MockBinaryMessenger<T>: NSObject, FlutterBinaryMessenger { diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MultipleArityTests.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MultipleArityTests.swift index 52155f892..f42933b23 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MultipleArityTests.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MultipleArityTests.swift @@ -4,6 +4,7 @@ import Flutter import XCTest + @testable import test_plugin class MockMultipleArityHostApi: MultipleArityHostApi { @@ -16,7 +17,8 @@ class MultipleArityTests: XCTestCase { var codec = FlutterStandardMessageCodec.sharedInstance() func testSimpleHost() throws { let binaryMessenger = MockBinaryMessenger<Int64>(codec: EnumApi2HostCodec.shared) - MultipleArityHostApiSetup.setUp(binaryMessenger: binaryMessenger, api: MockMultipleArityHostApi()) + MultipleArityHostApiSetup.setUp( + binaryMessenger: binaryMessenger, api: MockMultipleArityHostApi()) let channelName = "dev.flutter.pigeon.pigeon_integration_tests.MultipleArityHostApi.subtract" XCTAssertNotNil(binaryMessenger.handlers[channelName]) @@ -28,10 +30,10 @@ class MultipleArityTests: XCTestCase { binaryMessenger.handlers[channelName]?(inputEncoded) { data in let outputList = binaryMessenger.codec.decode(data) as? [Any] XCTAssertNotNil(outputList) - + let output = outputList![0] as? Int64 XCTAssertEqual(3, output) - XCTAssertTrue(outputList?.count == 1) + XCTAssertTrue(outputList?.count == 1) expectation.fulfill() } wait(for: [expectation], timeout: 1.0) @@ -46,11 +48,11 @@ class MultipleArityTests: XCTestCase { let expectation = XCTestExpectation(description: "subtraction") api.subtract(x: 30, y: 10) { result in switch result { - case .success(let res) : - XCTAssertEqual(20, res) - expectation.fulfill() - case .failure(_) : - return + case .success(let res): + XCTAssertEqual(20, res) + expectation.fulfill() + case .failure(_): + return } } wait(for: [expectation], timeout: 1.0) diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NSNullFieldTests.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NSNullFieldTests.swift index 036608f2f..a10a88d01 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NSNullFieldTests.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NSNullFieldTests.swift @@ -3,6 +3,7 @@ // found in the LICENSE file. import XCTest + @testable import test_plugin /// Tests NSNull is correctly handled by `nilOrValue` helper, by manually setting nullable fields to NSNull. diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NonNullFieldsTest.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NonNullFieldsTest.swift index ce1f4579a..07ccb6b6c 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NonNullFieldsTest.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NonNullFieldsTest.swift @@ -3,6 +3,7 @@ // found in the LICENSE file. import XCTest + @testable import test_plugin class NonNullFieldsTests: XCTestCase { diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NullableReturnsTests.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NullableReturnsTests.swift index dca9d6e3d..cf56bebd5 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NullableReturnsTests.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NullableReturnsTests.swift @@ -4,6 +4,7 @@ import Flutter import XCTest + @testable import test_plugin class MockNullableArgHostApi: NullableArgHostApi { @@ -27,11 +28,11 @@ class NullableReturnsTests: XCTestCase { let expectation = XCTestExpectation(description: "callback") api.doit(x: nil) { result in switch result { - case .success(let res) : - XCTAssertEqual(99, res) - expectation.fulfill() - case .failure(_) : - return + case .success(let res): + XCTAssertEqual(99, res) + expectation.fulfill() + case .failure(_): + return } } wait(for: [expectation], timeout: 1.0) diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/PrimitiveTests.swift b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/PrimitiveTests.swift index 86b118e7f..2f99f45f1 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/PrimitiveTests.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/PrimitiveTests.swift @@ -4,12 +4,13 @@ import Flutter import XCTest + @testable import test_plugin class MockPrimitiveHostApi: PrimitiveHostApi { func anInt(value: Int64) -> Int64 { value } func aBool(value: Bool) -> Bool { value } - func aString(value: String) -> String { value } + func aString(value: String) -> String { value } func aDouble(value: Double) -> Double { value } func aMap(value: [AnyHashable: Any?]) -> [AnyHashable: Any?] { value } func aList(value: [Any?]) -> [Any?] { value } @@ -34,7 +35,7 @@ class PrimitiveTests: XCTestCase { binaryMessenger.handlers[channelName]?(inputEncoded) { data in let outputList = binaryMessenger.codec.decode(data) as? [Any] XCTAssertNotNil(outputList) - + let output = outputList!.first as? Int64 XCTAssertEqual(1, output) XCTAssertTrue(outputList!.count == 1) @@ -50,12 +51,12 @@ class PrimitiveTests: XCTestCase { let expectation = XCTestExpectation(description: "callback") api.anInt(value: 1) { result in switch result { - case .success(let res) : - XCTAssertEqual(1, res) - expectation.fulfill() - case .failure(_) : - return - + case .success(let res): + XCTAssertEqual(1, res) + expectation.fulfill() + case .failure(_): + return + } } wait(for: [expectation], timeout: 1.0) @@ -74,7 +75,7 @@ class PrimitiveTests: XCTestCase { binaryMessenger.handlers[channelName]?(inputEncoded) { data in let outputList = binaryMessenger.codec.decode(data) as? [Any] XCTAssertNotNil(outputList) - + let output = outputList!.first as? Bool XCTAssertEqual(true, output) XCTAssertTrue(outputList!.count == 1) @@ -90,11 +91,11 @@ class PrimitiveTests: XCTestCase { let expectation = XCTestExpectation(description: "callback") api.aBool(value: true) { result in switch result { - case .success(let res) : - XCTAssertEqual(true, res) - expectation.fulfill() - case .failure(_) : - return + case .success(let res): + XCTAssertEqual(true, res) + expectation.fulfill() + case .failure(_): + return } } wait(for: [expectation], timeout: 1.0) @@ -113,7 +114,7 @@ class PrimitiveTests: XCTestCase { binaryMessenger.handlers[channelName]?(inputEncoded) { data in let outputList = binaryMessenger.codec.decode(data) as? [Any] XCTAssertNotNil(outputList) - + let output = outputList!.first as? Double XCTAssertEqual(1.0, output) XCTAssertTrue(outputList!.count == 1) @@ -130,11 +131,11 @@ class PrimitiveTests: XCTestCase { let arg: Double = 1.5 api.aDouble(value: arg) { result in switch result { - case .success(let res) : - XCTAssertEqual(arg, res) - expectation.fulfill() - case .failure(_) : - return + case .success(let res): + XCTAssertEqual(arg, res) + expectation.fulfill() + case .failure(_): + return } } wait(for: [expectation], timeout: 1.0) @@ -153,7 +154,7 @@ class PrimitiveTests: XCTestCase { binaryMessenger.handlers[channelName]?(inputEncoded) { data in let outputList = binaryMessenger.codec.decode(data) as? [Any] XCTAssertNotNil(outputList) - + let output = outputList!.first as? String XCTAssertEqual("hello", output) XCTAssertTrue(outputList!.count == 1) @@ -170,11 +171,11 @@ class PrimitiveTests: XCTestCase { let arg: String = "hello" api.aString(value: arg) { result in switch result { - case .success(let res) : - XCTAssertEqual(arg, res) - expectation.fulfill() - case .failure(_) : - return + case .success(let res): + XCTAssertEqual(arg, res) + expectation.fulfill() + case .failure(_): + return } } wait(for: [expectation], timeout: 1.0) @@ -193,7 +194,7 @@ class PrimitiveTests: XCTestCase { binaryMessenger.handlers[channelName]?(inputEncoded) { data in let outputList = binaryMessenger.codec.decode(data) as? [Any] XCTAssertNotNil(outputList) - + let output = outputList!.first as? [Int] XCTAssertEqual([1, 2, 3], output) XCTAssertTrue(outputList!.count == 1) @@ -210,11 +211,11 @@ class PrimitiveTests: XCTestCase { let arg = ["hello"] api.aList(value: arg) { result in switch result { - case .success(let res) : - XCTAssert(equalsList(arg, res)) - expectation.fulfill() - case .failure(_) : - return + case .success(let res): + XCTAssert(equalsList(arg, res)) + expectation.fulfill() + case .failure(_): + return } } wait(for: [expectation], timeout: 1.0) @@ -250,11 +251,11 @@ class PrimitiveTests: XCTestCase { let arg = ["hello": 1] api.aMap(value: arg) { result in switch result { - case .success(let res) : - XCTAssert(equalsDictionary(arg, res)) - expectation.fulfill() - case .failure(_) : - return + case .success(let res): + XCTAssert(equalsDictionary(arg, res)) + expectation.fulfill() + case .failure(_): + return } } diff --git a/packages/pigeon/platform_tests/test_plugin/example/macos/RunnerTests/BasicCompileTest.swift b/packages/pigeon/platform_tests/test_plugin/example/macos/RunnerTests/BasicCompileTest.swift index a828ca540..b3a751166 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/macos/RunnerTests/BasicCompileTest.swift +++ b/packages/pigeon/platform_tests/test_plugin/example/macos/RunnerTests/BasicCompileTest.swift @@ -3,6 +3,7 @@ // found in the LICENSE file. import XCTest + @testable import test_plugin class MyApi: HostTrivialApi { diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift index 773b6e5c1..14bcb9a41 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift @@ -1,17 +1,18 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// +// // Autogenerated from Pigeon, do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif private func wrapResult(_ result: Any?) -> [Any?] { @@ -23,18 +24,20 @@ private func wrapError(_ error: Any) -> [Any?] { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } private func createConnectionError(withChannelName channelName: String) -> FlutterError { - return FlutterError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") + return FlutterError( + code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", + details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -143,8 +146,10 @@ struct AllNullableTypes { static func fromList(_ list: [Any?]) -> AllNullableTypes? { let aNullableBool: Bool? = nilOrValue(list[0]) - let aNullableInt: Int64? = isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) - let aNullableInt64: Int64? = isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) + let aNullableInt: Int64? = + isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) + let aNullableInt64: Int64? = + isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) let aNullableDouble: Double? = nilOrValue(list[3]) let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(list[4]) let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(list[5]) @@ -250,7 +255,7 @@ struct TestMessage { } func toList() -> [Any?] { return [ - testList, + testList ] } } @@ -258,16 +263,16 @@ struct TestMessage { private class HostIntegrationCoreApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return AllClassesWrapper.fromList(self.readValue() as! [Any?]) - case 129: - return AllNullableTypes.fromList(self.readValue() as! [Any?]) - case 130: - return AllTypes.fromList(self.readValue() as! [Any?]) - case 131: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + case 129: + return AllNullableTypes.fromList(self.readValue() as! [Any?]) + case 130: + return AllTypes.fromList(self.readValue() as! [Any?]) + case 131: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -303,7 +308,8 @@ private class HostIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderWrit } class HostIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = HostIntegrationCoreApiCodec(readerWriter: HostIntegrationCoreApiCodecReaderWriter()) + static let shared = HostIntegrationCoreApiCodec( + readerWriter: HostIntegrationCoreApiCodecReaderWriter()) } /// The core interface that each host language plugin must implement in @@ -357,7 +363,9 @@ protocol HostIntegrationCoreApi { /// sending of nested objects. func createNestedObject(with nullableString: String?) throws -> AllClassesWrapper /// Returns passed in arguments of multiple types. - func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?) throws -> AllNullableTypes + func sendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String? + ) throws -> AllNullableTypes /// Returns passed in int. func echo(_ aNullableInt: Int64?) throws -> Int64? /// Returns passed in double. @@ -391,13 +399,16 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsync(_ aString: String, completion: @escaping (Result<String, Error>) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsync(_ aUint8List: FlutterStandardTypedData, completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void) + func echoAsync( + _ aUint8List: FlutterStandardTypedData, + completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsync(_ anObject: Any, completion: @escaping (Result<Any, Error>) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsync(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsync(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func echoAsync( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) /// Returns the passed enum, to test asynchronous serialization and deserialization. func echoAsync(_ anEnum: AnEnum, completion: @escaping (Result<AnEnum, Error>) -> Void) /// Responds with an error from an async function returning a value. @@ -409,7 +420,9 @@ protocol HostIntegrationCoreApi { /// Returns the passed object, to test async serialization and deserialization. func echoAsync(_ everything: AllTypes, completion: @escaping (Result<AllTypes, Error>) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoAsync(_ everything: AllNullableTypes?, completion: @escaping (Result<AllNullableTypes?, Error>) -> Void) + func echoAsync( + _ everything: AllNullableTypes?, + completion: @escaping (Result<AllNullableTypes?, Error>) -> Void) /// Returns passed in int asynchronously. func echoAsyncNullable(_ anInt: Int64?, completion: @escaping (Result<Int64?, Error>) -> Void) /// Returns passed in double asynchronously. @@ -419,37 +432,56 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsyncNullable(_ aString: String?, completion: @escaping (Result<String?, Error>) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsyncNullable(_ aUint8List: FlutterStandardTypedData?, completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void) + func echoAsyncNullable( + _ aUint8List: FlutterStandardTypedData?, + completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsyncNullable(_ anObject: Any?, completion: @escaping (Result<Any?, Error>) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsyncNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsyncNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func echoAsyncNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) /// Returns the passed enum, to test asynchronous serialization and deserialization. func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result<AnEnum?, Error>) -> Void) func callFlutterNoop(completion: @escaping (Result<Void, Error>) -> Void) func callFlutterThrowError(completion: @escaping (Result<Any?, Error>) -> Void) func callFlutterThrowErrorFromVoid(completion: @escaping (Result<Void, Error>) -> Void) - func callFlutterEcho(_ everything: AllTypes, completion: @escaping (Result<AllTypes, Error>) -> Void) - func callFlutterEcho(_ everything: AllNullableTypes?, completion: @escaping (Result<AllNullableTypes?, Error>) -> Void) - func callFlutterSendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, completion: @escaping (Result<AllNullableTypes, Error>) -> Void) + func callFlutterEcho( + _ everything: AllTypes, completion: @escaping (Result<AllTypes, Error>) -> Void) + func callFlutterEcho( + _ everything: AllNullableTypes?, + completion: @escaping (Result<AllNullableTypes?, Error>) -> Void) + func callFlutterSendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, + completion: @escaping (Result<AllNullableTypes, Error>) -> Void) func callFlutterEcho(_ aBool: Bool, completion: @escaping (Result<Bool, Error>) -> Void) func callFlutterEcho(_ anInt: Int64, completion: @escaping (Result<Int64, Error>) -> Void) func callFlutterEcho(_ aDouble: Double, completion: @escaping (Result<Double, Error>) -> Void) func callFlutterEcho(_ aString: String, completion: @escaping (Result<String, Error>) -> Void) - func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void) + func callFlutterEcho( + _ aList: FlutterStandardTypedData, + completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void) func callFlutterEcho(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) - func callFlutterEcho(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func callFlutterEcho( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result<AnEnum, Error>) -> Void) func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result<Bool?, Error>) -> Void) - func callFlutterEchoNullable(_ anInt: Int64?, completion: @escaping (Result<Int64?, Error>) -> Void) - func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Result<Double?, Error>) -> Void) - func callFlutterEchoNullable(_ aString: String?, completion: @escaping (Result<String?, Error>) -> Void) - func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void) - func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) - func callFlutterEchoNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) - func callFlutterNullableEcho(_ anEnum: AnEnum?, completion: @escaping (Result<AnEnum?, Error>) -> Void) + func callFlutterEchoNullable( + _ anInt: Int64?, completion: @escaping (Result<Int64?, Error>) -> Void) + func callFlutterEchoNullable( + _ aDouble: Double?, completion: @escaping (Result<Double?, Error>) -> Void) + func callFlutterEchoNullable( + _ aString: String?, completion: @escaping (Result<String?, Error>) -> Void) + func callFlutterEchoNullable( + _ aList: FlutterStandardTypedData?, + completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void) + func callFlutterEchoNullable( + _ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) + func callFlutterEchoNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func callFlutterNullableEcho( + _ anEnum: AnEnum?, completion: @escaping (Result<AnEnum?, Error>) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -460,7 +492,9 @@ class HostIntegrationCoreApiSetup { static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostIntegrationCoreApi?) { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. - let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", binaryMessenger: binaryMessenger, codec: codec) + let noopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -474,7 +508,9 @@ class HostIntegrationCoreApiSetup { noopChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAllTypesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -490,7 +526,9 @@ class HostIntegrationCoreApiSetup { echoAllTypesChannel.setMessageHandler(nil) } /// Returns an error, to test error handling. - let throwErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", binaryMessenger: binaryMessenger, codec: codec) + let throwErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorChannel.setMessageHandler { _, reply in do { @@ -504,7 +542,9 @@ class HostIntegrationCoreApiSetup { throwErrorChannel.setMessageHandler(nil) } /// Returns an error from a void function, to test error handling. - let throwErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let throwErrorFromVoidChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorFromVoidChannel.setMessageHandler { _, reply in do { @@ -518,7 +558,9 @@ class HostIntegrationCoreApiSetup { throwErrorFromVoidChannel.setMessageHandler(nil) } /// Returns a Flutter error, to test error handling. - let throwFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", binaryMessenger: binaryMessenger, codec: codec) + let throwFlutterErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwFlutterErrorChannel.setMessageHandler { _, reply in do { @@ -532,7 +574,9 @@ class HostIntegrationCoreApiSetup { throwFlutterErrorChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec) + let echoIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -548,7 +592,9 @@ class HostIntegrationCoreApiSetup { echoIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -564,7 +610,9 @@ class HostIntegrationCoreApiSetup { echoDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec) + let echoBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -580,7 +628,9 @@ class HostIntegrationCoreApiSetup { echoBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec) + let echoStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -596,7 +646,9 @@ class HostIntegrationCoreApiSetup { echoStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoUint8ListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -612,7 +664,9 @@ class HostIntegrationCoreApiSetup { echoUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", binaryMessenger: binaryMessenger, codec: codec) + let echoObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -628,7 +682,9 @@ class HostIntegrationCoreApiSetup { echoObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec) + let echoListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -644,7 +700,9 @@ class HostIntegrationCoreApiSetup { echoListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec) + let echoMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -660,7 +718,9 @@ class HostIntegrationCoreApiSetup { echoMapChannel.setMessageHandler(nil) } /// Returns the passed map to test nested class serialization and deserialization. - let echoClassWrapperChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", binaryMessenger: binaryMessenger, codec: codec) + let echoClassWrapperChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoClassWrapperChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -676,7 +736,9 @@ class HostIntegrationCoreApiSetup { echoClassWrapperChannel.setMessageHandler(nil) } /// Returns the passed enum to test serialization and deserialization. - let echoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -692,7 +754,10 @@ class HostIntegrationCoreApiSetup { echoEnumChannel.setMessageHandler(nil) } /// Returns the default string. - let echoNamedDefaultStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", binaryMessenger: binaryMessenger, codec: codec) + let echoNamedDefaultStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedDefaultStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -708,7 +773,10 @@ class HostIntegrationCoreApiSetup { echoNamedDefaultStringChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalDefaultDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -724,7 +792,9 @@ class HostIntegrationCoreApiSetup { echoOptionalDefaultDoubleChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoRequiredIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", binaryMessenger: binaryMessenger, codec: codec) + let echoRequiredIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoRequiredIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -740,7 +810,10 @@ class HostIntegrationCoreApiSetup { echoRequiredIntChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -757,7 +830,10 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let extractNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let extractNestedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { extractNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -774,7 +850,10 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let createNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let createNestedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { createNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -790,15 +869,21 @@ class HostIntegrationCoreApiSetup { createNestedNullableStringChannel.setMessageHandler(nil) } /// Returns passed in arguments of multiple types. - let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { sendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[1]) + ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) do { - let result = try api.sendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) + let result = try api.sendMultipleNullableTypes( + aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -808,11 +893,15 @@ class HostIntegrationCoreApiSetup { sendMultipleNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echo(aNullableIntArg) reply(wrapResult(result)) @@ -824,7 +913,9 @@ class HostIntegrationCoreApiSetup { echoNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -840,7 +931,9 @@ class HostIntegrationCoreApiSetup { echoNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -856,7 +949,9 @@ class HostIntegrationCoreApiSetup { echoNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -872,7 +967,10 @@ class HostIntegrationCoreApiSetup { echoNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -888,7 +986,9 @@ class HostIntegrationCoreApiSetup { echoNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -904,7 +1004,9 @@ class HostIntegrationCoreApiSetup { echoNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -920,7 +1022,9 @@ class HostIntegrationCoreApiSetup { echoNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -935,7 +1039,9 @@ class HostIntegrationCoreApiSetup { } else { echoNullableMapChannel.setMessageHandler(nil) } - let echoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -951,11 +1057,16 @@ class HostIntegrationCoreApiSetup { echoNullableEnumChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoOptionalNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echoOptional(aNullableIntArg) reply(wrapResult(result)) @@ -967,7 +1078,10 @@ class HostIntegrationCoreApiSetup { echoOptionalNullableIntChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNamedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoNamedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -984,15 +1098,17 @@ class HostIntegrationCoreApiSetup { } /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. - let noopAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", binaryMessenger: binaryMessenger, codec: codec) + let noopAsyncChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopAsyncChannel.setMessageHandler { _, reply in - api.noopAsync() { result in + api.noopAsync { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1000,17 +1116,19 @@ class HostIntegrationCoreApiSetup { noopAsyncChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) api.echoAsync(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1018,17 +1136,19 @@ class HostIntegrationCoreApiSetup { echoAsyncIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double api.echoAsync(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1036,17 +1156,19 @@ class HostIntegrationCoreApiSetup { echoAsyncDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool api.echoAsync(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1054,17 +1176,19 @@ class HostIntegrationCoreApiSetup { echoAsyncBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String api.echoAsync(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1072,17 +1196,19 @@ class HostIntegrationCoreApiSetup { echoAsyncStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncUint8ListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aUint8ListArg = args[0] as! FlutterStandardTypedData api.echoAsync(aUint8ListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1090,17 +1216,19 @@ class HostIntegrationCoreApiSetup { echoAsyncUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anObjectArg = args[0]! api.echoAsync(anObjectArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1108,17 +1236,19 @@ class HostIntegrationCoreApiSetup { echoAsyncObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! [Any?] api.echoAsync(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1126,17 +1256,19 @@ class HostIntegrationCoreApiSetup { echoAsyncListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg = args[0] as! [String?: Any?] api.echoAsync(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1144,17 +1276,19 @@ class HostIntegrationCoreApiSetup { echoAsyncMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg = AnEnum(rawValue: args[0] as! Int)! api.echoAsync(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1162,15 +1296,17 @@ class HostIntegrationCoreApiSetup { echoAsyncEnumChannel.setMessageHandler(nil) } /// Responds with an error from an async function returning a value. - let throwAsyncErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorChannel.setMessageHandler { _, reply in - api.throwAsyncError() { result in + api.throwAsyncError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1178,15 +1314,18 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorChannel.setMessageHandler(nil) } /// Responds with an error from an async void function. - let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorFromVoidChannel.setMessageHandler { _, reply in - api.throwAsyncErrorFromVoid() { result in + api.throwAsyncErrorFromVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1194,15 +1333,18 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorFromVoidChannel.setMessageHandler(nil) } /// Responds with a Flutter error from an async function returning a value. - let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncFlutterErrorChannel.setMessageHandler { _, reply in - api.throwAsyncFlutterError() { result in + api.throwAsyncFlutterError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1210,17 +1352,19 @@ class HostIntegrationCoreApiSetup { throwAsyncFlutterErrorChannel.setMessageHandler(nil) } /// Returns the passed object, to test async serialization and deserialization. - let echoAsyncAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncAllTypesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes api.echoAsync(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1228,17 +1372,20 @@ class HostIntegrationCoreApiSetup { echoAsyncAllTypesChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg: AllNullableTypes? = nilOrValue(args[0]) api.echoAsync(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1246,17 +1393,22 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableAllNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.echoAsyncNullable(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1264,17 +1416,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg: Double? = nilOrValue(args[0]) api.echoAsyncNullable(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1282,17 +1437,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg: Bool? = nilOrValue(args[0]) api.echoAsyncNullable(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1300,17 +1458,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg: String? = nilOrValue(args[0]) api.echoAsyncNullable(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1318,17 +1479,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aUint8ListArg: FlutterStandardTypedData? = nilOrValue(args[0]) api.echoAsyncNullable(aUint8ListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1336,17 +1500,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anObjectArg: Any? = args[0] api.echoAsyncNullable(anObjectArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1354,17 +1521,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg: [Any?]? = nilOrValue(args[0]) api.echoAsyncNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1372,17 +1542,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableMapChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg: [String?: Any?]? = nilOrValue(args[0]) api.echoAsyncNullable(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1390,387 +1563,459 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg: AnEnum? = isNullish(args[0]) ? nil : AnEnum(rawValue: args[0] as! Int)! api.echoAsyncNullable(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res?.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res?.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } } else { echoAsyncNullableEnumChannel.setMessageHandler(nil) } - let callFlutterNoopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterNoopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterNoopChannel.setMessageHandler { _, reply in - api.callFlutterNoop() { result in + api.callFlutterNoop { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterNoopChannel.setMessageHandler(nil) } - let callFlutterThrowErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorChannel.setMessageHandler { _, reply in - api.callFlutterThrowError() { result in + api.callFlutterThrowError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterThrowErrorChannel.setMessageHandler(nil) } - let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorFromVoidChannel.setMessageHandler { _, reply in - api.callFlutterThrowErrorFromVoid() { result in + api.callFlutterThrowErrorFromVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterThrowErrorFromVoidChannel.setMessageHandler(nil) } - let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes api.callFlutterEcho(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoAllTypesChannel.setMessageHandler(nil) } - let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg: AllNullableTypes? = nilOrValue(args[0]) api.callFlutterEcho(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoAllNullableTypesChannel.setMessageHandler(nil) } - let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterSendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[1]) + ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) - api.callFlutterSendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) { result in + api.callFlutterSendMultipleNullableTypes( + aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg + ) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterSendMultipleNullableTypesChannel.setMessageHandler(nil) } - let callFlutterEchoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool api.callFlutterEcho(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoBoolChannel.setMessageHandler(nil) } - let callFlutterEchoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) api.callFlutterEcho(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoIntChannel.setMessageHandler(nil) } - let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double api.callFlutterEcho(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String api.callFlutterEcho(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoStringChannel.setMessageHandler(nil) } - let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! FlutterStandardTypedData api.callFlutterEcho(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! [Any?] api.callFlutterEcho(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoListChannel.setMessageHandler(nil) } - let callFlutterEchoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg = args[0] as! [String?: Any?] api.callFlutterEcho(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoMapChannel.setMessageHandler(nil) } - let callFlutterEchoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg = AnEnum(rawValue: args[0] as! Int)! api.callFlutterEcho(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoEnumChannel.setMessageHandler(nil) } - let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg: Bool? = nilOrValue(args[0]) api.callFlutterEchoNullable(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableBoolChannel.setMessageHandler(nil) } - let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.callFlutterEchoNullable(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + 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", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg: Double? = nilOrValue(args[0]) api.callFlutterEchoNullable(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg: String? = nilOrValue(args[0]) api.callFlutterEchoNullable(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableStringChannel.setMessageHandler(nil) } - let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg: FlutterStandardTypedData? = nilOrValue(args[0]) api.callFlutterEchoNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg: [Any?]? = nilOrValue(args[0]) api.callFlutterEchoNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg: [String?: Any?]? = nilOrValue(args[0]) api.callFlutterEchoNullable(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableMapChannel.setMessageHandler(nil) } - let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg: AnEnum? = isNullish(args[0]) ? nil : AnEnum(rawValue: args[0] as! Int)! api.callFlutterNullableEcho(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res?.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res?.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1782,16 +2027,16 @@ class HostIntegrationCoreApiSetup { private class FlutterIntegrationCoreApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return AllClassesWrapper.fromList(self.readValue() as! [Any?]) - case 129: - return AllNullableTypes.fromList(self.readValue() as! [Any?]) - case 130: - return AllTypes.fromList(self.readValue() as! [Any?]) - case 131: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + case 129: + return AllNullableTypes.fromList(self.readValue() as! [Any?]) + case 130: + return AllTypes.fromList(self.readValue() as! [Any?]) + case 131: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -1827,7 +2072,8 @@ private class FlutterIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderW } class FlutterIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = FlutterIntegrationCoreApiCodec(readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) + static let shared = FlutterIntegrationCoreApiCodec( + readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) } /// The core interface that the Dart platform_test code implements for host @@ -1843,13 +2089,19 @@ protocol FlutterIntegrationCoreApiProtocol { /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result<Void, FlutterError>) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echo(_ everythingArg: AllTypes, completion: @escaping (Result<AllTypes, FlutterError>) -> Void) + func echo( + _ everythingArg: AllTypes, completion: @escaping (Result<AllTypes, FlutterError>) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result<AllNullableTypes?, FlutterError>) -> Void) + func echoNullable( + _ everythingArg: AllNullableTypes?, + completion: @escaping (Result<AllNullableTypes?, FlutterError>) -> 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<AllNullableTypes, FlutterError>) -> Void) + func sendMultipleNullableTypes( + aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, + aString aNullableStringArg: String?, + completion: @escaping (Result<AllNullableTypes, FlutterError>) -> Void) /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result<Bool, FlutterError>) -> Void) /// Returns the passed int, to test serialization and deserialization. @@ -1859,29 +2111,42 @@ protocol FlutterIntegrationCoreApiProtocol { /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result<String, FlutterError>) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result<FlutterStandardTypedData, FlutterError>) -> Void) + func echo( + _ aListArg: FlutterStandardTypedData, + completion: @escaping (Result<FlutterStandardTypedData, FlutterError>) -> Void) /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) + func echo( + _ aMapArg: [String?: Any?], + completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, completion: @escaping (Result<AnEnum, FlutterError>) -> Void) /// Returns the passed boolean, to test serialization and deserialization. func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result<Bool?, FlutterError>) -> Void) /// Returns the passed int, to test serialization and deserialization. - func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result<Int64?, FlutterError>) -> Void) + func echoNullable( + _ anIntArg: Int64?, completion: @escaping (Result<Int64?, FlutterError>) -> Void) /// Returns the passed double, to test serialization and deserialization. - func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result<Double?, FlutterError>) -> Void) + func echoNullable( + _ aDoubleArg: Double?, completion: @escaping (Result<Double?, FlutterError>) -> Void) /// Returns the passed string, to test serialization and deserialization. - func echoNullable(_ aStringArg: String?, completion: @escaping (Result<String?, FlutterError>) -> Void) + func echoNullable( + _ aStringArg: String?, completion: @escaping (Result<String?, FlutterError>) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result<FlutterStandardTypedData?, FlutterError>) -> Void) + func echoNullable( + _ aListArg: FlutterStandardTypedData?, + completion: @escaping (Result<FlutterStandardTypedData?, FlutterError>) -> Void) /// Returns the passed list, to test serialization and deserialization. - func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) + func echoNullable( + _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) + func echoNullable( + _ aMapArg: [String?: Any?]?, + completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. - func echoNullable(_ anEnumArg: AnEnum?, completion: @escaping (Result<AnEnum?, FlutterError>) -> Void) + func echoNullable( + _ anEnumArg: AnEnum?, completion: @escaping (Result<AnEnum?, FlutterError>) -> Void) /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result<Void, FlutterError>) -> Void) @@ -1890,7 +2155,7 @@ protocol FlutterIntegrationCoreApiProtocol { } class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } var codec: FlutterStandardMessageCodec { @@ -1899,18 +2164,20 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. func noop(completion: @escaping (Result<Void, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } @@ -1918,18 +2185,20 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async function returning a value. func throwError(completion: @escaping (Result<Any?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Any? = listResponse[0] completion(.success(result)) @@ -1938,39 +2207,49 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result<Void, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } } } /// Returns the passed object, to test serialization and deserialization. - func echo(_ everythingArg: AllTypes, completion: @escaping (Result<AllTypes, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ everythingArg: AllTypes, completion: @escaping (Result<AllTypes, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllTypes completion(.success(result)) @@ -1978,19 +2257,24 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed object, to test serialization and deserialization. - func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result<AllNullableTypes?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ everythingArg: AllNullableTypes?, + completion: @escaping (Result<AllNullableTypes?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: AllNullableTypes? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2000,21 +2284,32 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, aString aNullableStringArg: String?, completion: @escaping (Result<AllNullableTypes, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in + func sendMultipleNullableTypes( + aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, + aString aNullableStringArg: String?, + completion: @escaping (Result<AllNullableTypes, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllNullableTypes completion(.success(result)) @@ -2023,20 +2318,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result<Bool, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Bool completion(.success(result)) @@ -2045,42 +2346,55 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed int, to test serialization and deserialization. func echo(_ anIntArg: Int64, completion: @escaping (Result<Int64, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { - let result = listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) + let result = + listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. func echo(_ aDoubleArg: Double, completion: @escaping (Result<Double, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Double completion(.success(result)) @@ -2089,20 +2403,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result<String, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2110,21 +2430,30 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result<FlutterStandardTypedData, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ aListArg: FlutterStandardTypedData, + completion: @escaping (Result<FlutterStandardTypedData, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! FlutterStandardTypedData completion(.success(result)) @@ -2133,20 +2462,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [Any?] completion(.success(result)) @@ -2154,21 +2489,30 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ aMapArg: [String?: Any?], + completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [String?: Any?] completion(.success(result)) @@ -2177,20 +2521,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, completion: @escaping (Result<AnEnum, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) @@ -2198,19 +2548,22 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result<Bool?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result<Bool?, FlutterError>) -> Void) + { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Bool? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2218,39 +2571,51 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed int, to test serialization and deserialization. - func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result<Int64?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ anIntArg: Int64?, completion: @escaping (Result<Int64?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: Int64? = isNullish(listResponse[0]) ? nil : (listResponse[0] is Int64? ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) + let result: Int64? = + isNullish(listResponse[0]) + ? nil + : (listResponse[0] is Int64? + ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. - func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result<Double?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aDoubleArg: Double?, completion: @escaping (Result<Double?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Double? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2258,19 +2623,23 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed string, to test serialization and deserialization. - func echoNullable(_ aStringArg: String?, completion: @escaping (Result<String?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aStringArg: String?, completion: @escaping (Result<String?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: String? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2278,19 +2647,24 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result<FlutterStandardTypedData?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aListArg: FlutterStandardTypedData?, + completion: @escaping (Result<FlutterStandardTypedData?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: FlutterStandardTypedData? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2298,19 +2672,23 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed list, to test serialization and deserialization. - func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: [Any?]? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2318,19 +2696,24 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aMapArg: [String?: Any?]?, + completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: [String?: Any?]? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2338,21 +2721,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed enum to test serialization and deserialization. - func echoNullable(_ anEnumArg: AnEnum?, completion: @escaping (Result<AnEnum?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ anEnumArg: AnEnum?, completion: @escaping (Result<AnEnum?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg?.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: AnEnum? = isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! + let result: AnEnum? = + isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) } } @@ -2360,39 +2748,48 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result<Void, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } } } /// Returns the passed in generic Object asynchronously. - func echoAsync(_ aStringArg: String, completion: @escaping (Result<String, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoAsync(_ aStringArg: String, completion: @escaping (Result<String, FlutterError>) -> Void) + { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2412,7 +2809,9 @@ class HostTrivialApiSetup { /// The codec used by HostTrivialApi. /// Sets up an instance of `HostTrivialApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostTrivialApi?) { - let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", binaryMessenger: binaryMessenger) + let noopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", + binaryMessenger: binaryMessenger) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -2440,32 +2839,36 @@ class HostSmallApiSetup { /// The codec used by HostSmallApi. /// Sets up an instance of `HostSmallApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostSmallApi?) { - let echoChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", binaryMessenger: binaryMessenger) + let echoChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", + binaryMessenger: binaryMessenger) if let api = api { echoChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String api.echo(aString: aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { echoChannel.setMessageHandler(nil) } - let voidVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", binaryMessenger: binaryMessenger) + let voidVoidChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", + binaryMessenger: binaryMessenger) if let api = api { voidVoidChannel.setMessageHandler { _, reply in - api.voidVoid() { result in + api.voidVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -2477,10 +2880,10 @@ class HostSmallApiSetup { private class FlutterSmallApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -2514,32 +2917,41 @@ class FlutterSmallApiCodec: FlutterStandardMessageCodec { /// /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol FlutterSmallApiProtocol { - func echo(_ msgArg: TestMessage, completion: @escaping (Result<TestMessage, FlutterError>) -> Void) + func echo( + _ msgArg: TestMessage, completion: @escaping (Result<TestMessage, FlutterError>) -> Void) func echo(_ aStringArg: String, completion: @escaping (Result<String, FlutterError>) -> Void) } class FlutterSmallApi: FlutterSmallApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } var codec: FlutterStandardMessageCodec { return FlutterSmallApiCodec.shared } - func echo(_ msgArg: TestMessage, completion: @escaping (Result<TestMessage, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ msgArg: TestMessage, completion: @escaping (Result<TestMessage, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([msgArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! TestMessage completion(.success(result)) @@ -2547,20 +2959,26 @@ class FlutterSmallApi: FlutterSmallApiProtocol { } } func echo(_ aStringArg: String, completion: @escaping (Result<String, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) diff --git a/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift b/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift index 8b4daf5a0..0d04c9544 100644 --- a/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift +++ b/packages/pigeon/platform_tests/test_plugin/ios/Classes/TestPlugin.swift @@ -7,10 +7,8 @@ import UIKit extension FlutterError: Error {} -/** - * This plugin handles the native side of the integration tests in - * example/integration_test/. - */ +/// This plugin handles the native side of the integration tests in +/// example/integration_test/. public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { var flutterAPI: FlutterIntegrationCoreApi @@ -90,15 +88,18 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } func extractNestedNullableString(from wrapper: AllClassesWrapper) -> String? { - return wrapper.allNullableTypes.aNullableString; + return wrapper.allNullableTypes.aNullableString } func createNestedObject(with nullableString: String?) -> AllClassesWrapper { return AllClassesWrapper(allNullableTypes: AllNullableTypes(aNullableString: nullableString)) } - func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?) -> AllNullableTypes { - let someThings = AllNullableTypes(aNullableBool: aNullableBool, aNullableInt: aNullableInt, aNullableString: aNullableString) + func sendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String? + ) -> AllNullableTypes { + let someThings = AllNullableTypes( + aNullableBool: aNullableBool, aNullableInt: aNullableInt, aNullableString: aNullableString) return someThings } @@ -178,7 +179,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(everything)) } - func echoAsync(_ everything: AllNullableTypes?, completion: @escaping (Result<AllNullableTypes?, Error>) -> Void) { + func echoAsync( + _ everything: AllNullableTypes?, + completion: @escaping (Result<AllNullableTypes?, Error>) -> Void + ) { completion(.success(everything)) } @@ -198,7 +202,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aString)) } - func echoAsync(_ aUint8List: FlutterStandardTypedData, completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void) { + func echoAsync( + _ aUint8List: FlutterStandardTypedData, + completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void + ) { completion(.success(aUint8List)) } @@ -210,7 +217,9 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aList)) } - func echoAsync(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) { + func echoAsync( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void + ) { completion(.success(aMap)) } @@ -222,7 +231,8 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(anInt)) } - func echoAsyncNullable(_ aDouble: Double?, completion: @escaping (Result<Double?, Error>) -> Void) { + func echoAsyncNullable(_ aDouble: Double?, completion: @escaping (Result<Double?, Error>) -> Void) + { completion(.success(aDouble)) } @@ -230,11 +240,15 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aBool)) } - func echoAsyncNullable(_ aString: String?, completion: @escaping (Result<String?, Error>) -> Void) { + func echoAsyncNullable(_ aString: String?, completion: @escaping (Result<String?, Error>) -> Void) + { completion(.success(aString)) } - func echoAsyncNullable(_ aUint8List: FlutterStandardTypedData?, completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void) { + func echoAsyncNullable( + _ aUint8List: FlutterStandardTypedData?, + completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void + ) { completion(.success(aUint8List)) } @@ -246,66 +260,74 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aList)) } - func echoAsyncNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) { + func echoAsyncNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void + ) { completion(.success(aMap)) } - func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result<AnEnum?, Error>) -> Void) { + func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result<AnEnum?, Error>) -> Void) + { completion(.success(anEnum)) } func callFlutterNoop(completion: @escaping (Result<Void, Error>) -> Void) { - flutterAPI.noop() { response in + flutterAPI.noop { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } func callFlutterThrowError(completion: @escaping (Result<Any?, Error>) -> Void) { - flutterAPI.throwError() { response in + flutterAPI.throwError { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } func callFlutterThrowErrorFromVoid(completion: @escaping (Result<Void, Error>) -> Void) { - flutterAPI.throwErrorFromVoid() { response in + flutterAPI.throwErrorFromVoid { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEcho(_ everything: AllTypes, completion: @escaping (Result<AllTypes, Error>) -> Void) { + func callFlutterEcho( + _ everything: AllTypes, completion: @escaping (Result<AllTypes, Error>) -> Void + ) { flutterAPI.echo(everything) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) + } } } - func callFlutterEcho(_ everything: AllNullableTypes?, completion: @escaping (Result<AllNullableTypes?, Error>) -> Void) { + func callFlutterEcho( + _ everything: AllNullableTypes?, + completion: @escaping (Result<AllNullableTypes?, Error>) -> Void + ) { flutterAPI.echoNullable(everything) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) + } } } @@ -321,10 +343,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { aString: aNullableString ) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -332,10 +354,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aBool: Bool, completion: @escaping (Result<Bool, Error>) -> Void) { flutterAPI.echo(aBool) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -343,10 +365,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ anInt: Int64, completion: @escaping (Result<Int64, Error>) -> Void) { flutterAPI.echo(anInt) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -354,10 +376,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aDouble: Double, completion: @escaping (Result<Double, Error>) -> Void) { flutterAPI.echo(aDouble) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -365,21 +387,24 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aString: String, completion: @escaping (Result<String, Error>) -> Void) { flutterAPI.echo(aString) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void) { + func callFlutterEcho( + _ aList: FlutterStandardTypedData, + completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void + ) { flutterAPI.echo(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -387,21 +412,23 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) { flutterAPI.echo(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEcho(_ aMap: [String? : Any?], completion: @escaping (Result<[String? : Any?], Error>) -> Void) { + func callFlutterEcho( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void + ) { flutterAPI.echo(aMap) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -409,99 +436,115 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result<AnEnum, Error>) -> Void) { flutterAPI.echo(anEnum) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result<Bool?, Error>) -> Void) { + func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result<Bool?, Error>) -> Void) + { flutterAPI.echoNullable(aBool) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ anInt: Int64?, completion: @escaping (Result<Int64?, Error>) -> Void) { + func callFlutterEchoNullable( + _ anInt: Int64?, completion: @escaping (Result<Int64?, Error>) -> Void + ) { flutterAPI.echoNullable(anInt) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Result<Double?, Error>) -> Void) { + func callFlutterEchoNullable( + _ aDouble: Double?, completion: @escaping (Result<Double?, Error>) -> Void + ) { flutterAPI.echoNullable(aDouble) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aString: String?, completion: @escaping (Result<String?, Error>) -> Void) { + func callFlutterEchoNullable( + _ aString: String?, completion: @escaping (Result<String?, Error>) -> Void + ) { flutterAPI.echoNullable(aString) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - - func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void) { + + func callFlutterEchoNullable( + _ aList: FlutterStandardTypedData?, + completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void + ) { flutterAPI.echoNullable(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) { + func callFlutterEchoNullable( + _ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void + ) { flutterAPI.echoNullable(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aMap: [String? : Any?]?, completion: @escaping (Result<[String? : Any?]?, Error>) -> Void) { + func callFlutterEchoNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void + ) { flutterAPI.echoNullable(aMap) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterNullableEcho(_ anEnum: AnEnum?, completion: @escaping (Result<AnEnum?, Error>) -> Void) { + func callFlutterNullableEcho( + _ anEnum: AnEnum?, completion: @escaping (Result<AnEnum?, Error>) -> Void + ) { flutterAPI.echoNullable(anEnum) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } - } + } } } diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift index 773b6e5c1..14bcb9a41 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift @@ -1,17 +1,18 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// +// // Autogenerated from Pigeon, do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif private func wrapResult(_ result: Any?) -> [Any?] { @@ -23,18 +24,20 @@ private func wrapError(_ error: Any) -> [Any?] { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } private func createConnectionError(withChannelName channelName: String) -> FlutterError { - return FlutterError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") + return FlutterError( + code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", + details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -143,8 +146,10 @@ struct AllNullableTypes { static func fromList(_ list: [Any?]) -> AllNullableTypes? { let aNullableBool: Bool? = nilOrValue(list[0]) - let aNullableInt: Int64? = isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) - let aNullableInt64: Int64? = isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) + let aNullableInt: Int64? = + isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) + let aNullableInt64: Int64? = + isNullish(list[2]) ? nil : (list[2] is Int64? ? list[2] as! Int64? : Int64(list[2] as! Int32)) let aNullableDouble: Double? = nilOrValue(list[3]) let aNullableByteArray: FlutterStandardTypedData? = nilOrValue(list[4]) let aNullable4ByteArray: FlutterStandardTypedData? = nilOrValue(list[5]) @@ -250,7 +255,7 @@ struct TestMessage { } func toList() -> [Any?] { return [ - testList, + testList ] } } @@ -258,16 +263,16 @@ struct TestMessage { private class HostIntegrationCoreApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return AllClassesWrapper.fromList(self.readValue() as! [Any?]) - case 129: - return AllNullableTypes.fromList(self.readValue() as! [Any?]) - case 130: - return AllTypes.fromList(self.readValue() as! [Any?]) - case 131: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + case 129: + return AllNullableTypes.fromList(self.readValue() as! [Any?]) + case 130: + return AllTypes.fromList(self.readValue() as! [Any?]) + case 131: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -303,7 +308,8 @@ private class HostIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderWrit } class HostIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = HostIntegrationCoreApiCodec(readerWriter: HostIntegrationCoreApiCodecReaderWriter()) + static let shared = HostIntegrationCoreApiCodec( + readerWriter: HostIntegrationCoreApiCodecReaderWriter()) } /// The core interface that each host language plugin must implement in @@ -357,7 +363,9 @@ protocol HostIntegrationCoreApi { /// sending of nested objects. func createNestedObject(with nullableString: String?) throws -> AllClassesWrapper /// Returns passed in arguments of multiple types. - func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?) throws -> AllNullableTypes + func sendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String? + ) throws -> AllNullableTypes /// Returns passed in int. func echo(_ aNullableInt: Int64?) throws -> Int64? /// Returns passed in double. @@ -391,13 +399,16 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsync(_ aString: String, completion: @escaping (Result<String, Error>) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsync(_ aUint8List: FlutterStandardTypedData, completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void) + func echoAsync( + _ aUint8List: FlutterStandardTypedData, + completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsync(_ anObject: Any, completion: @escaping (Result<Any, Error>) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsync(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsync(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func echoAsync( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) /// Returns the passed enum, to test asynchronous serialization and deserialization. func echoAsync(_ anEnum: AnEnum, completion: @escaping (Result<AnEnum, Error>) -> Void) /// Responds with an error from an async function returning a value. @@ -409,7 +420,9 @@ protocol HostIntegrationCoreApi { /// Returns the passed object, to test async serialization and deserialization. func echoAsync(_ everything: AllTypes, completion: @escaping (Result<AllTypes, Error>) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoAsync(_ everything: AllNullableTypes?, completion: @escaping (Result<AllNullableTypes?, Error>) -> Void) + func echoAsync( + _ everything: AllNullableTypes?, + completion: @escaping (Result<AllNullableTypes?, Error>) -> Void) /// Returns passed in int asynchronously. func echoAsyncNullable(_ anInt: Int64?, completion: @escaping (Result<Int64?, Error>) -> Void) /// Returns passed in double asynchronously. @@ -419,37 +432,56 @@ protocol HostIntegrationCoreApi { /// Returns the passed string asynchronously. func echoAsyncNullable(_ aString: String?, completion: @escaping (Result<String?, Error>) -> Void) /// Returns the passed in Uint8List asynchronously. - func echoAsyncNullable(_ aUint8List: FlutterStandardTypedData?, completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void) + func echoAsyncNullable( + _ aUint8List: FlutterStandardTypedData?, + completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void) /// Returns the passed in generic Object asynchronously. func echoAsyncNullable(_ anObject: Any?, completion: @escaping (Result<Any?, Error>) -> Void) /// Returns the passed list, to test asynchronous serialization and deserialization. func echoAsyncNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) /// Returns the passed map, to test asynchronous serialization and deserialization. - func echoAsyncNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func echoAsyncNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) /// Returns the passed enum, to test asynchronous serialization and deserialization. func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result<AnEnum?, Error>) -> Void) func callFlutterNoop(completion: @escaping (Result<Void, Error>) -> Void) func callFlutterThrowError(completion: @escaping (Result<Any?, Error>) -> Void) func callFlutterThrowErrorFromVoid(completion: @escaping (Result<Void, Error>) -> Void) - func callFlutterEcho(_ everything: AllTypes, completion: @escaping (Result<AllTypes, Error>) -> Void) - func callFlutterEcho(_ everything: AllNullableTypes?, completion: @escaping (Result<AllNullableTypes?, Error>) -> Void) - func callFlutterSendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, completion: @escaping (Result<AllNullableTypes, Error>) -> Void) + func callFlutterEcho( + _ everything: AllTypes, completion: @escaping (Result<AllTypes, Error>) -> Void) + func callFlutterEcho( + _ everything: AllNullableTypes?, + completion: @escaping (Result<AllNullableTypes?, Error>) -> Void) + func callFlutterSendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?, + completion: @escaping (Result<AllNullableTypes, Error>) -> Void) func callFlutterEcho(_ aBool: Bool, completion: @escaping (Result<Bool, Error>) -> Void) func callFlutterEcho(_ anInt: Int64, completion: @escaping (Result<Int64, Error>) -> Void) func callFlutterEcho(_ aDouble: Double, completion: @escaping (Result<Double, Error>) -> Void) func callFlutterEcho(_ aString: String, completion: @escaping (Result<String, Error>) -> Void) - func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void) + func callFlutterEcho( + _ aList: FlutterStandardTypedData, + completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void) func callFlutterEcho(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) - func callFlutterEcho(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) + func callFlutterEcho( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result<AnEnum, Error>) -> Void) func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result<Bool?, Error>) -> Void) - func callFlutterEchoNullable(_ anInt: Int64?, completion: @escaping (Result<Int64?, Error>) -> Void) - func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Result<Double?, Error>) -> Void) - func callFlutterEchoNullable(_ aString: String?, completion: @escaping (Result<String?, Error>) -> Void) - func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void) - func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) - func callFlutterEchoNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) - func callFlutterNullableEcho(_ anEnum: AnEnum?, completion: @escaping (Result<AnEnum?, Error>) -> Void) + func callFlutterEchoNullable( + _ anInt: Int64?, completion: @escaping (Result<Int64?, Error>) -> Void) + func callFlutterEchoNullable( + _ aDouble: Double?, completion: @escaping (Result<Double?, Error>) -> Void) + func callFlutterEchoNullable( + _ aString: String?, completion: @escaping (Result<String?, Error>) -> Void) + func callFlutterEchoNullable( + _ aList: FlutterStandardTypedData?, + completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void) + func callFlutterEchoNullable( + _ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) + func callFlutterEchoNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) + func callFlutterNullableEcho( + _ anEnum: AnEnum?, completion: @escaping (Result<AnEnum?, Error>) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -460,7 +492,9 @@ class HostIntegrationCoreApiSetup { static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostIntegrationCoreApi?) { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. - let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", binaryMessenger: binaryMessenger, codec: codec) + let noopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noop", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -474,7 +508,9 @@ class HostIntegrationCoreApiSetup { noopChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAllTypesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -490,7 +526,9 @@ class HostIntegrationCoreApiSetup { echoAllTypesChannel.setMessageHandler(nil) } /// Returns an error, to test error handling. - let throwErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", binaryMessenger: binaryMessenger, codec: codec) + let throwErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorChannel.setMessageHandler { _, reply in do { @@ -504,7 +542,9 @@ class HostIntegrationCoreApiSetup { throwErrorChannel.setMessageHandler(nil) } /// Returns an error from a void function, to test error handling. - let throwErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let throwErrorFromVoidChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwErrorFromVoidChannel.setMessageHandler { _, reply in do { @@ -518,7 +558,9 @@ class HostIntegrationCoreApiSetup { throwErrorFromVoidChannel.setMessageHandler(nil) } /// Returns a Flutter error, to test error handling. - let throwFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", binaryMessenger: binaryMessenger, codec: codec) + let throwFlutterErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwFlutterError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwFlutterErrorChannel.setMessageHandler { _, reply in do { @@ -532,7 +574,9 @@ class HostIntegrationCoreApiSetup { throwFlutterErrorChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", binaryMessenger: binaryMessenger, codec: codec) + let echoIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -548,7 +592,9 @@ class HostIntegrationCoreApiSetup { echoIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -564,7 +610,9 @@ class HostIntegrationCoreApiSetup { echoDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", binaryMessenger: binaryMessenger, codec: codec) + let echoBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -580,7 +628,9 @@ class HostIntegrationCoreApiSetup { echoBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", binaryMessenger: binaryMessenger, codec: codec) + let echoStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -596,7 +646,9 @@ class HostIntegrationCoreApiSetup { echoStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoUint8ListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -612,7 +664,9 @@ class HostIntegrationCoreApiSetup { echoUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", binaryMessenger: binaryMessenger, codec: codec) + let echoObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -628,7 +682,9 @@ class HostIntegrationCoreApiSetup { echoObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", binaryMessenger: binaryMessenger, codec: codec) + let echoListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -644,7 +700,9 @@ class HostIntegrationCoreApiSetup { echoListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", binaryMessenger: binaryMessenger, codec: codec) + let echoMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -660,7 +718,9 @@ class HostIntegrationCoreApiSetup { echoMapChannel.setMessageHandler(nil) } /// Returns the passed map to test nested class serialization and deserialization. - let echoClassWrapperChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", binaryMessenger: binaryMessenger, codec: codec) + let echoClassWrapperChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoClassWrapper", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoClassWrapperChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -676,7 +736,9 @@ class HostIntegrationCoreApiSetup { echoClassWrapperChannel.setMessageHandler(nil) } /// Returns the passed enum to test serialization and deserialization. - let echoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -692,7 +754,10 @@ class HostIntegrationCoreApiSetup { echoEnumChannel.setMessageHandler(nil) } /// Returns the default string. - let echoNamedDefaultStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", binaryMessenger: binaryMessenger, codec: codec) + let echoNamedDefaultStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedDefaultString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedDefaultStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -708,7 +773,10 @@ class HostIntegrationCoreApiSetup { echoNamedDefaultStringChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalDefaultDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalDefaultDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalDefaultDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -724,7 +792,9 @@ class HostIntegrationCoreApiSetup { echoOptionalDefaultDoubleChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoRequiredIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", binaryMessenger: binaryMessenger, codec: codec) + let echoRequiredIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoRequiredInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoRequiredIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -740,7 +810,10 @@ class HostIntegrationCoreApiSetup { echoRequiredIntChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -757,7 +830,10 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let extractNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let extractNestedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.extractNestedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { extractNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -774,7 +850,10 @@ class HostIntegrationCoreApiSetup { } /// Returns the inner `aString` value from the wrapped object, to test /// sending of nested objects. - let createNestedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let createNestedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.createNestedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { createNestedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -790,15 +869,21 @@ class HostIntegrationCoreApiSetup { createNestedNullableStringChannel.setMessageHandler(nil) } /// Returns passed in arguments of multiple types. - let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let sendMultipleNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.sendMultipleNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { sendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[1]) + ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) do { - let result = try api.sendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) + let result = try api.sendMultipleNullableTypes( + aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -808,11 +893,15 @@ class HostIntegrationCoreApiSetup { sendMultipleNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echo(aNullableIntArg) reply(wrapResult(result)) @@ -824,7 +913,9 @@ class HostIntegrationCoreApiSetup { echoNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double. - let echoNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -840,7 +931,9 @@ class HostIntegrationCoreApiSetup { echoNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean. - let echoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -856,7 +949,9 @@ class HostIntegrationCoreApiSetup { echoNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -872,7 +967,10 @@ class HostIntegrationCoreApiSetup { echoNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List. - let echoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -888,7 +986,9 @@ class HostIntegrationCoreApiSetup { echoNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object. - let echoNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -904,7 +1004,9 @@ class HostIntegrationCoreApiSetup { echoNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test serialization and deserialization. - let echoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -920,7 +1022,9 @@ class HostIntegrationCoreApiSetup { echoNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test serialization and deserialization. - let echoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -935,7 +1039,9 @@ class HostIntegrationCoreApiSetup { } else { echoNullableMapChannel.setMessageHandler(nil) } - let echoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoNullableEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -951,11 +1057,16 @@ class HostIntegrationCoreApiSetup { echoNullableEnumChannel.setMessageHandler(nil) } /// Returns passed in int. - let echoOptionalNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoOptionalNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoOptionalNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoOptionalNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let aNullableIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) do { let result = try api.echoOptional(aNullableIntArg) reply(wrapResult(result)) @@ -967,7 +1078,10 @@ class HostIntegrationCoreApiSetup { echoOptionalNullableIntChannel.setMessageHandler(nil) } /// Returns the passed in string. - let echoNamedNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoNamedNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoNamedNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoNamedNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -984,15 +1098,17 @@ class HostIntegrationCoreApiSetup { } /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. - let noopAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", binaryMessenger: binaryMessenger, codec: codec) + let noopAsyncChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.noopAsync", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { noopAsyncChannel.setMessageHandler { _, reply in - api.noopAsync() { result in + api.noopAsync { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1000,17 +1116,19 @@ class HostIntegrationCoreApiSetup { noopAsyncChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) api.echoAsync(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1018,17 +1136,19 @@ class HostIntegrationCoreApiSetup { echoAsyncIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncDoubleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double api.echoAsync(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1036,17 +1156,19 @@ class HostIntegrationCoreApiSetup { echoAsyncDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncBoolChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool api.echoAsync(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1054,17 +1176,19 @@ class HostIntegrationCoreApiSetup { echoAsyncBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String api.echoAsync(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1072,17 +1196,19 @@ class HostIntegrationCoreApiSetup { echoAsyncStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncUint8ListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aUint8ListArg = args[0] as! FlutterStandardTypedData api.echoAsync(aUint8ListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1090,17 +1216,19 @@ class HostIntegrationCoreApiSetup { echoAsyncUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncObjectChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anObjectArg = args[0]! api.echoAsync(anObjectArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1108,17 +1236,19 @@ class HostIntegrationCoreApiSetup { echoAsyncObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncListChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! [Any?] api.echoAsync(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1126,17 +1256,19 @@ class HostIntegrationCoreApiSetup { echoAsyncListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg = args[0] as! [String?: Any?] api.echoAsync(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1144,17 +1276,19 @@ class HostIntegrationCoreApiSetup { echoAsyncMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncEnumChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg = AnEnum(rawValue: args[0] as! Int)! api.echoAsync(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1162,15 +1296,17 @@ class HostIntegrationCoreApiSetup { echoAsyncEnumChannel.setMessageHandler(nil) } /// Responds with an error from an async function returning a value. - let throwAsyncErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorChannel.setMessageHandler { _, reply in - api.throwAsyncError() { result in + api.throwAsyncError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1178,15 +1314,18 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorChannel.setMessageHandler(nil) } /// Responds with an error from an async void function. - let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncErrorFromVoidChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncErrorFromVoidChannel.setMessageHandler { _, reply in - api.throwAsyncErrorFromVoid() { result in + api.throwAsyncErrorFromVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1194,15 +1333,18 @@ class HostIntegrationCoreApiSetup { throwAsyncErrorFromVoidChannel.setMessageHandler(nil) } /// Responds with a Flutter error from an async function returning a value. - let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", binaryMessenger: binaryMessenger, codec: codec) + let throwAsyncFlutterErrorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.throwAsyncFlutterError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { throwAsyncFlutterErrorChannel.setMessageHandler { _, reply in - api.throwAsyncFlutterError() { result in + api.throwAsyncFlutterError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1210,17 +1352,19 @@ class HostIntegrationCoreApiSetup { throwAsyncFlutterErrorChannel.setMessageHandler(nil) } /// Returns the passed object, to test async serialization and deserialization. - let echoAsyncAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncAllTypesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes api.echoAsync(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1228,17 +1372,20 @@ class HostIntegrationCoreApiSetup { echoAsyncAllTypesChannel.setMessageHandler(nil) } /// Returns the passed object, to test serialization and deserialization. - let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg: AllNullableTypes? = nilOrValue(args[0]) api.echoAsync(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1246,17 +1393,22 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableAllNullableTypesChannel.setMessageHandler(nil) } /// Returns passed in int asynchronously. - let echoAsyncNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.echoAsyncNullable(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1264,17 +1416,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableIntChannel.setMessageHandler(nil) } /// Returns passed in double asynchronously. - let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg: Double? = nilOrValue(args[0]) api.echoAsyncNullable(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1282,17 +1437,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableDoubleChannel.setMessageHandler(nil) } /// Returns the passed in boolean asynchronously. - let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg: Bool? = nilOrValue(args[0]) api.echoAsyncNullable(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1300,17 +1458,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableBoolChannel.setMessageHandler(nil) } /// Returns the passed string asynchronously. - let echoAsyncNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg: String? = nilOrValue(args[0]) api.echoAsyncNullable(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1318,17 +1479,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableStringChannel.setMessageHandler(nil) } /// Returns the passed in Uint8List asynchronously. - let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aUint8ListArg: FlutterStandardTypedData? = nilOrValue(args[0]) api.echoAsyncNullable(aUint8ListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1336,17 +1500,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableUint8ListChannel.setMessageHandler(nil) } /// Returns the passed in generic Object asynchronously. - let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableObjectChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableObject", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableObjectChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anObjectArg: Any? = args[0] api.echoAsyncNullable(anObjectArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1354,17 +1521,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableObjectChannel.setMessageHandler(nil) } /// Returns the passed list, to test asynchronous serialization and deserialization. - let echoAsyncNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg: [Any?]? = nilOrValue(args[0]) api.echoAsyncNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1372,17 +1542,20 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableListChannel.setMessageHandler(nil) } /// Returns the passed map, to test asynchronous serialization and deserialization. - let echoAsyncNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableMapChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg: [String?: Any?]? = nilOrValue(args[0]) api.echoAsyncNullable(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1390,387 +1563,459 @@ class HostIntegrationCoreApiSetup { echoAsyncNullableMapChannel.setMessageHandler(nil) } /// Returns the passed enum, to test asynchronous serialization and deserialization. - let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let echoAsyncNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.echoAsyncNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { echoAsyncNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg: AnEnum? = isNullish(args[0]) ? nil : AnEnum(rawValue: args[0] as! Int)! api.echoAsyncNullable(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res?.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res?.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } } else { echoAsyncNullableEnumChannel.setMessageHandler(nil) } - let callFlutterNoopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterNoopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterNoop", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterNoopChannel.setMessageHandler { _, reply in - api.callFlutterNoop() { result in + api.callFlutterNoop { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterNoopChannel.setMessageHandler(nil) } - let callFlutterThrowErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorChannel.setMessageHandler { _, reply in - api.callFlutterThrowError() { result in + api.callFlutterThrowError { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterThrowErrorChannel.setMessageHandler(nil) } - let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterThrowErrorFromVoidChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterThrowErrorFromVoid", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterThrowErrorFromVoidChannel.setMessageHandler { _, reply in - api.callFlutterThrowErrorFromVoid() { result in + api.callFlutterThrowErrorFromVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterThrowErrorFromVoidChannel.setMessageHandler(nil) } - let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg = args[0] as! AllTypes api.callFlutterEcho(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoAllTypesChannel.setMessageHandler(nil) } - let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoAllNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoAllNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoAllNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let everythingArg: AllNullableTypes? = nilOrValue(args[0]) api.callFlutterEcho(everythingArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoAllNullableTypesChannel.setMessageHandler(nil) } - let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterSendMultipleNullableTypesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterSendMultipleNullableTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterSendMultipleNullableTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aNullableBoolArg: Bool? = nilOrValue(args[0]) - let aNullableIntArg: Int64? = isNullish(args[1]) ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) + let aNullableIntArg: Int64? = + isNullish(args[1]) + ? nil : (args[1] is Int64? ? args[1] as! Int64? : Int64(args[1] as! Int32)) let aNullableStringArg: String? = nilOrValue(args[2]) - api.callFlutterSendMultipleNullableTypes(aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg) { result in + api.callFlutterSendMultipleNullableTypes( + aBool: aNullableBoolArg, anInt: aNullableIntArg, aString: aNullableStringArg + ) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterSendMultipleNullableTypesChannel.setMessageHandler(nil) } - let callFlutterEchoBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg = args[0] as! Bool api.callFlutterEcho(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoBoolChannel.setMessageHandler(nil) } - let callFlutterEchoIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoIntChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anIntArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) api.callFlutterEcho(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoIntChannel.setMessageHandler(nil) } - let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg = args[0] as! Double api.callFlutterEcho(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String api.callFlutterEcho(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoStringChannel.setMessageHandler(nil) } - let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! FlutterStandardTypedData api.callFlutterEcho(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg = args[0] as! [Any?] api.callFlutterEcho(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoListChannel.setMessageHandler(nil) } - let callFlutterEchoMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoMapChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg = args[0] as! [String?: Any?] api.callFlutterEcho(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoMapChannel.setMessageHandler(nil) } - let callFlutterEchoEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg = AnEnum(rawValue: args[0] as! Int)! api.callFlutterEcho(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoEnumChannel.setMessageHandler(nil) } - let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableBoolChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableBool", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableBoolChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aBoolArg: Bool? = nilOrValue(args[0]) api.callFlutterEchoNullable(aBoolArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableBoolChannel.setMessageHandler(nil) } - let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableIntChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableInt", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableIntChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let anIntArg: Int64? = isNullish(args[0]) ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) + let anIntArg: Int64? = + isNullish(args[0]) + ? nil : (args[0] is Int64? ? args[0] as! Int64? : Int64(args[0] as! Int32)) api.callFlutterEchoNullable(anIntArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + 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", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableDoubleChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableDouble", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableDoubleChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aDoubleArg: Double? = nilOrValue(args[0]) api.callFlutterEchoNullable(aDoubleArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableDoubleChannel.setMessageHandler(nil) } - let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableStringChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg: String? = nilOrValue(args[0]) api.callFlutterEchoNullable(aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableStringChannel.setMessageHandler(nil) } - let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableUint8ListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableUint8List", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableUint8ListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg: FlutterStandardTypedData? = nilOrValue(args[0]) api.callFlutterEchoNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableUint8ListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableListChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableList", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableListChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aListArg: [Any?]? = nilOrValue(args[0]) api.callFlutterEchoNullable(aListArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableListChannel.setMessageHandler(nil) } - let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableMapChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableMap", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableMapChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aMapArg: [String?: Any?]? = nilOrValue(args[0]) api.callFlutterEchoNullable(aMapArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { callFlutterEchoNullableMapChannel.setMessageHandler(nil) } - let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", binaryMessenger: binaryMessenger, codec: codec) + let callFlutterEchoNullableEnumChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.pigeon_integration_tests.HostIntegrationCoreApi.callFlutterEchoNullableEnum", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { callFlutterEchoNullableEnumChannel.setMessageHandler { message, reply in let args = message as! [Any?] let anEnumArg: AnEnum? = isNullish(args[0]) ? nil : AnEnum(rawValue: args[0] as! Int)! api.callFlutterNullableEcho(anEnumArg) { result in switch result { - case .success(let res): - reply(wrapResult(res?.rawValue)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res?.rawValue)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -1782,16 +2027,16 @@ class HostIntegrationCoreApiSetup { private class FlutterIntegrationCoreApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return AllClassesWrapper.fromList(self.readValue() as! [Any?]) - case 129: - return AllNullableTypes.fromList(self.readValue() as! [Any?]) - case 130: - return AllTypes.fromList(self.readValue() as! [Any?]) - case 131: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return AllClassesWrapper.fromList(self.readValue() as! [Any?]) + case 129: + return AllNullableTypes.fromList(self.readValue() as! [Any?]) + case 130: + return AllTypes.fromList(self.readValue() as! [Any?]) + case 131: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -1827,7 +2072,8 @@ private class FlutterIntegrationCoreApiCodecReaderWriter: FlutterStandardReaderW } class FlutterIntegrationCoreApiCodec: FlutterStandardMessageCodec { - static let shared = FlutterIntegrationCoreApiCodec(readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) + static let shared = FlutterIntegrationCoreApiCodec( + readerWriter: FlutterIntegrationCoreApiCodecReaderWriter()) } /// The core interface that the Dart platform_test code implements for host @@ -1843,13 +2089,19 @@ protocol FlutterIntegrationCoreApiProtocol { /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result<Void, FlutterError>) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echo(_ everythingArg: AllTypes, completion: @escaping (Result<AllTypes, FlutterError>) -> Void) + func echo( + _ everythingArg: AllTypes, completion: @escaping (Result<AllTypes, FlutterError>) -> Void) /// Returns the passed object, to test serialization and deserialization. - func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result<AllNullableTypes?, FlutterError>) -> Void) + func echoNullable( + _ everythingArg: AllNullableTypes?, + completion: @escaping (Result<AllNullableTypes?, FlutterError>) -> 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<AllNullableTypes, FlutterError>) -> Void) + func sendMultipleNullableTypes( + aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, + aString aNullableStringArg: String?, + completion: @escaping (Result<AllNullableTypes, FlutterError>) -> Void) /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result<Bool, FlutterError>) -> Void) /// Returns the passed int, to test serialization and deserialization. @@ -1859,29 +2111,42 @@ protocol FlutterIntegrationCoreApiProtocol { /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result<String, FlutterError>) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result<FlutterStandardTypedData, FlutterError>) -> Void) + func echo( + _ aListArg: FlutterStandardTypedData, + completion: @escaping (Result<FlutterStandardTypedData, FlutterError>) -> Void) /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) + func echo( + _ aMapArg: [String?: Any?], + completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, completion: @escaping (Result<AnEnum, FlutterError>) -> Void) /// Returns the passed boolean, to test serialization and deserialization. func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result<Bool?, FlutterError>) -> Void) /// Returns the passed int, to test serialization and deserialization. - func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result<Int64?, FlutterError>) -> Void) + func echoNullable( + _ anIntArg: Int64?, completion: @escaping (Result<Int64?, FlutterError>) -> Void) /// Returns the passed double, to test serialization and deserialization. - func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result<Double?, FlutterError>) -> Void) + func echoNullable( + _ aDoubleArg: Double?, completion: @escaping (Result<Double?, FlutterError>) -> Void) /// Returns the passed string, to test serialization and deserialization. - func echoNullable(_ aStringArg: String?, completion: @escaping (Result<String?, FlutterError>) -> Void) + func echoNullable( + _ aStringArg: String?, completion: @escaping (Result<String?, FlutterError>) -> Void) /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result<FlutterStandardTypedData?, FlutterError>) -> Void) + func echoNullable( + _ aListArg: FlutterStandardTypedData?, + completion: @escaping (Result<FlutterStandardTypedData?, FlutterError>) -> Void) /// Returns the passed list, to test serialization and deserialization. - func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) + func echoNullable( + _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) /// Returns the passed map, to test serialization and deserialization. - func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) + func echoNullable( + _ aMapArg: [String?: Any?]?, + completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) /// Returns the passed enum to test serialization and deserialization. - func echoNullable(_ anEnumArg: AnEnum?, completion: @escaping (Result<AnEnum?, FlutterError>) -> Void) + func echoNullable( + _ anEnumArg: AnEnum?, completion: @escaping (Result<AnEnum?, FlutterError>) -> Void) /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result<Void, FlutterError>) -> Void) @@ -1890,7 +2155,7 @@ protocol FlutterIntegrationCoreApiProtocol { } class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } var codec: FlutterStandardMessageCodec { @@ -1899,18 +2164,20 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic calling. func noop(completion: @escaping (Result<Void, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noop" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } @@ -1918,18 +2185,20 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async function returning a value. func throwError(completion: @escaping (Result<Any?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwError" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Any? = listResponse[0] completion(.success(result)) @@ -1938,39 +2207,49 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Responds with an error from an async void function. func throwErrorFromVoid(completion: @escaping (Result<Void, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.throwErrorFromVoid" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } } } /// Returns the passed object, to test serialization and deserialization. - func echo(_ everythingArg: AllTypes, completion: @escaping (Result<AllTypes, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ everythingArg: AllTypes, completion: @escaping (Result<AllTypes, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllTypes completion(.success(result)) @@ -1978,19 +2257,24 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed object, to test serialization and deserialization. - func echoNullable(_ everythingArg: AllNullableTypes?, completion: @escaping (Result<AllNullableTypes?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ everythingArg: AllNullableTypes?, + completion: @escaping (Result<AllNullableTypes?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAllNullableTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([everythingArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: AllNullableTypes? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2000,21 +2284,32 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// Returns passed in arguments of multiple types. /// /// Tests multiple-arity FlutterApi handling. - func sendMultipleNullableTypes(aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, aString aNullableStringArg: String?, completion: @escaping (Result<AllNullableTypes, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { response in + func sendMultipleNullableTypes( + aBool aNullableBoolArg: Bool?, anInt aNullableIntArg: Int64?, + aString aNullableStringArg: String?, + completion: @escaping (Result<AllNullableTypes, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.sendMultipleNullableTypes" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([aNullableBoolArg, aNullableIntArg, aNullableStringArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AllNullableTypes completion(.success(result)) @@ -2023,20 +2318,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed boolean, to test serialization and deserialization. func echo(_ aBoolArg: Bool, completion: @escaping (Result<Bool, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoBool" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Bool completion(.success(result)) @@ -2045,42 +2346,55 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed int, to test serialization and deserialization. func echo(_ anIntArg: Int64, completion: @escaping (Result<Int64, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoInt" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { - let result = listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) + let result = + listResponse[0] is Int64 ? listResponse[0] as! Int64 : Int64(listResponse[0] as! Int32) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. func echo(_ aDoubleArg: Double, completion: @escaping (Result<Double, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoDouble" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Double completion(.success(result)) @@ -2089,20 +2403,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed string, to test serialization and deserialization. func echo(_ aStringArg: String, completion: @escaping (Result<String, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2110,21 +2430,30 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echo(_ aListArg: FlutterStandardTypedData, completion: @escaping (Result<FlutterStandardTypedData, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ aListArg: FlutterStandardTypedData, + completion: @escaping (Result<FlutterStandardTypedData, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoUint8List" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! FlutterStandardTypedData completion(.success(result)) @@ -2133,20 +2462,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed list, to test serialization and deserialization. func echo(_ aListArg: [Any?], completion: @escaping (Result<[Any?], FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [Any?] completion(.success(result)) @@ -2154,21 +2489,30 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echo(_ aMapArg: [String?: Any?], completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ aMapArg: [String?: Any?], + completion: @escaping (Result<[String?: Any?], FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoMap" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [String?: Any?] completion(.success(result)) @@ -2177,20 +2521,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } /// Returns the passed enum to test serialization and deserialization. func echo(_ anEnumArg: AnEnum, completion: @escaping (Result<AnEnum, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoEnum" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) @@ -2198,19 +2548,22 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed boolean, to test serialization and deserialization. - func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result<Bool?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable(_ aBoolArg: Bool?, completion: @escaping (Result<Bool?, FlutterError>) -> Void) + { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableBool" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aBoolArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Bool? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2218,39 +2571,51 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed int, to test serialization and deserialization. - func echoNullable(_ anIntArg: Int64?, completion: @escaping (Result<Int64?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ anIntArg: Int64?, completion: @escaping (Result<Int64?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableInt" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anIntArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: Int64? = isNullish(listResponse[0]) ? nil : (listResponse[0] is Int64? ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) + let result: Int64? = + isNullish(listResponse[0]) + ? nil + : (listResponse[0] is Int64? + ? listResponse[0] as! Int64? : Int64(listResponse[0] as! Int32)) completion(.success(result)) } } } /// Returns the passed double, to test serialization and deserialization. - func echoNullable(_ aDoubleArg: Double?, completion: @escaping (Result<Double?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aDoubleArg: Double?, completion: @escaping (Result<Double?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableDouble" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aDoubleArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: Double? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2258,19 +2623,23 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed string, to test serialization and deserialization. - func echoNullable(_ aStringArg: String?, completion: @escaping (Result<String?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aStringArg: String?, completion: @escaping (Result<String?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: String? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2278,19 +2647,24 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed byte list, to test serialization and deserialization. - func echoNullable(_ aListArg: FlutterStandardTypedData?, completion: @escaping (Result<FlutterStandardTypedData?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aListArg: FlutterStandardTypedData?, + completion: @escaping (Result<FlutterStandardTypedData?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableUint8List" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: FlutterStandardTypedData? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2298,19 +2672,23 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed list, to test serialization and deserialization. - func echoNullable(_ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aListArg: [Any?]?, completion: @escaping (Result<[Any?]?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aListArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: [Any?]? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2318,19 +2696,24 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed map, to test serialization and deserialization. - func echoNullable(_ aMapArg: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ aMapArg: [String?: Any?]?, + completion: @escaping (Result<[String?: Any?]?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableMap" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aMapArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { let result: [String?: Any?]? = nilOrValue(listResponse[0]) completion(.success(result)) @@ -2338,21 +2721,26 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { } } /// Returns the passed enum to test serialization and deserialization. - func echoNullable(_ anEnumArg: AnEnum?, completion: @escaping (Result<AnEnum?, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoNullable( + _ anEnumArg: AnEnum?, completion: @escaping (Result<AnEnum?, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoNullableEnum" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([anEnumArg?.rawValue] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { - let result: AnEnum? = isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! + let result: AnEnum? = + isNullish(listResponse[0]) ? nil : AnEnum(rawValue: listResponse[0] as! Int)! completion(.success(result)) } } @@ -2360,39 +2748,48 @@ class FlutterIntegrationCoreApi: FlutterIntegrationCoreApiProtocol { /// A no-op function taking no arguments and returning no value, to sanity /// test basic asynchronous calling. func noopAsync(completion: @escaping (Result<Void, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.noopAsync" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage(nil) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); + completion(.failure(FlutterError(code: code, message: message, details: details))) } else { completion(.success(Void())) } } } /// Returns the passed in generic Object asynchronously. - func echoAsync(_ aStringArg: String, completion: @escaping (Result<String, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echoAsync(_ aStringArg: String, completion: @escaping (Result<String, FlutterError>) -> Void) + { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterIntegrationCoreApi.echoAsyncString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) @@ -2412,7 +2809,9 @@ class HostTrivialApiSetup { /// The codec used by HostTrivialApi. /// Sets up an instance of `HostTrivialApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostTrivialApi?) { - let noopChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", binaryMessenger: binaryMessenger) + let noopChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostTrivialApi.noop", + binaryMessenger: binaryMessenger) if let api = api { noopChannel.setMessageHandler { _, reply in do { @@ -2440,32 +2839,36 @@ class HostSmallApiSetup { /// The codec used by HostSmallApi. /// Sets up an instance of `HostSmallApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: HostSmallApi?) { - let echoChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", binaryMessenger: binaryMessenger) + let echoChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo", + binaryMessenger: binaryMessenger) if let api = api { echoChannel.setMessageHandler { message, reply in let args = message as! [Any?] let aStringArg = args[0] as! String api.echo(aString: aStringArg) { result in switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } } } else { echoChannel.setMessageHandler(nil) } - let voidVoidChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", binaryMessenger: binaryMessenger) + let voidVoidChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid", + binaryMessenger: binaryMessenger) if let api = api { voidVoidChannel.setMessageHandler { _, reply in - api.voidVoid() { result in + api.voidVoid { result in switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) } } } @@ -2477,10 +2880,10 @@ class HostSmallApiSetup { private class FlutterSmallApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return TestMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return TestMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -2514,32 +2917,41 @@ class FlutterSmallApiCodec: FlutterStandardMessageCodec { /// /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol FlutterSmallApiProtocol { - func echo(_ msgArg: TestMessage, completion: @escaping (Result<TestMessage, FlutterError>) -> Void) + func echo( + _ msgArg: TestMessage, completion: @escaping (Result<TestMessage, FlutterError>) -> Void) func echo(_ aStringArg: String, completion: @escaping (Result<String, FlutterError>) -> Void) } class FlutterSmallApi: FlutterSmallApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } var codec: FlutterStandardMessageCodec { return FlutterSmallApiCodec.shared } - func echo(_ msgArg: TestMessage, completion: @escaping (Result<TestMessage, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func echo( + _ msgArg: TestMessage, completion: @escaping (Result<TestMessage, FlutterError>) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoWrappedList" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([msgArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! TestMessage completion(.success(result)) @@ -2547,20 +2959,26 @@ class FlutterSmallApi: FlutterSmallApiProtocol { } } func echo(_ aStringArg: String, completion: @escaping (Result<String, FlutterError>) -> Void) { - let channelName: String = "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.pigeon_integration_tests.FlutterSmallApi.echoString" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([aStringArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName:channelName))) + completion(.failure(createConnectionError(withChannelName: channelName))) return } - if (listResponse.count > 1) { + if listResponse.count > 1 { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))); - } else if (listResponse[0] == nil) { - completion(.failure(FlutterError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion( + .failure( + FlutterError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! String completion(.success(result)) diff --git a/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift b/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift index c82f94b1c..5da16290c 100644 --- a/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift +++ b/packages/pigeon/platform_tests/test_plugin/macos/Classes/TestPlugin.swift @@ -7,10 +7,8 @@ import FlutterMacOS extension FlutterError: Error {} -/** - * This plugin handles the native side of the integration tests in - * example/integration_test/. - */ +/// This plugin handles the native side of the integration tests in +/// example/integration_test/. public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { var flutterAPI: FlutterIntegrationCoreApi @@ -102,15 +100,18 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { } func extractNestedNullableString(from wrapper: AllClassesWrapper) -> String? { - return wrapper.allNullableTypes.aNullableString; + return wrapper.allNullableTypes.aNullableString } func createNestedObject(with nullableString: String?) -> AllClassesWrapper { return AllClassesWrapper(allNullableTypes: AllNullableTypes(aNullableString: nullableString)) } - func sendMultipleNullableTypes(aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?) -> AllNullableTypes { - let someThings = AllNullableTypes(aNullableBool: aNullableBool, aNullableInt: aNullableInt, aNullableString: aNullableString) + func sendMultipleNullableTypes( + aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String? + ) -> AllNullableTypes { + let someThings = AllNullableTypes( + aNullableBool: aNullableBool, aNullableInt: aNullableInt, aNullableString: aNullableString) return someThings } @@ -178,7 +179,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(everything)) } - func echoAsync(_ everything: AllNullableTypes?, completion: @escaping (Result<AllNullableTypes?, Error>) -> Void) { + func echoAsync( + _ everything: AllNullableTypes?, + completion: @escaping (Result<AllNullableTypes?, Error>) -> Void + ) { completion(.success(everything)) } @@ -198,7 +202,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aString)) } - func echoAsync(_ aUint8List: FlutterStandardTypedData, completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void) { + func echoAsync( + _ aUint8List: FlutterStandardTypedData, + completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void + ) { completion(.success(aUint8List)) } @@ -210,7 +217,9 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aList)) } - func echoAsync(_ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void) { + func echoAsync( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void + ) { completion(.success(aMap)) } @@ -222,7 +231,8 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(anInt)) } - func echoAsyncNullable(_ aDouble: Double?, completion: @escaping (Result<Double?, Error>) -> Void) { + func echoAsyncNullable(_ aDouble: Double?, completion: @escaping (Result<Double?, Error>) -> Void) + { completion(.success(aDouble)) } @@ -230,11 +240,15 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aBool)) } - func echoAsyncNullable(_ aString: String?, completion: @escaping (Result<String?, Error>) -> Void) { + func echoAsyncNullable(_ aString: String?, completion: @escaping (Result<String?, Error>) -> Void) + { completion(.success(aString)) } - func echoAsyncNullable(_ aUint8List: FlutterStandardTypedData?, completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void) { + func echoAsyncNullable( + _ aUint8List: FlutterStandardTypedData?, + completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void + ) { completion(.success(aUint8List)) } @@ -246,66 +260,74 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { completion(.success(aList)) } - func echoAsyncNullable(_ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void) { + func echoAsyncNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void + ) { completion(.success(aMap)) } - func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result<AnEnum?, Error>) -> Void) { + func echoAsyncNullable(_ anEnum: AnEnum?, completion: @escaping (Result<AnEnum?, Error>) -> Void) + { completion(.success(anEnum)) } func callFlutterNoop(completion: @escaping (Result<Void, Error>) -> Void) { - flutterAPI.noop() { response in + flutterAPI.noop { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } func callFlutterThrowError(completion: @escaping (Result<Any?, Error>) -> Void) { - flutterAPI.throwError() { response in + flutterAPI.throwError { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } func callFlutterThrowErrorFromVoid(completion: @escaping (Result<Void, Error>) -> Void) { - flutterAPI.throwErrorFromVoid() { response in + flutterAPI.throwErrorFromVoid { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEcho(_ everything: AllTypes, completion: @escaping (Result<AllTypes, Error>) -> Void) { + func callFlutterEcho( + _ everything: AllTypes, completion: @escaping (Result<AllTypes, Error>) -> Void + ) { flutterAPI.echo(everything) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) + } } } - func callFlutterEcho(_ everything: AllNullableTypes?, completion: @escaping (Result<AllNullableTypes?, Error>) -> Void) { + func callFlutterEcho( + _ everything: AllNullableTypes?, + completion: @escaping (Result<AllNullableTypes?, Error>) -> Void + ) { flutterAPI.echoNullable(everything) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) - } + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) + } } } @@ -321,10 +343,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { aString: aNullableString ) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -332,10 +354,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aBool: Bool, completion: @escaping (Result<Bool, Error>) -> Void) { flutterAPI.echo(aBool) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -343,10 +365,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ anInt: Int64, completion: @escaping (Result<Int64, Error>) -> Void) { flutterAPI.echo(anInt) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -354,10 +376,10 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aDouble: Double, completion: @escaping (Result<Double, Error>) -> Void) { flutterAPI.echo(aDouble) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -365,21 +387,24 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aString: String, completion: @escaping (Result<String, Error>) -> Void) { flutterAPI.echo(aString) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEcho(_ aList: FlutterStandardTypedData, completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void) { + func callFlutterEcho( + _ aList: FlutterStandardTypedData, + completion: @escaping (Result<FlutterStandardTypedData, Error>) -> Void + ) { flutterAPI.echo(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -387,21 +412,23 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ aList: [Any?], completion: @escaping (Result<[Any?], Error>) -> Void) { flutterAPI.echo(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEcho(_ aMap: [String? : Any?], completion: @escaping (Result<[String? : Any?], Error>) -> Void) { + func callFlutterEcho( + _ aMap: [String?: Any?], completion: @escaping (Result<[String?: Any?], Error>) -> Void + ) { flutterAPI.echo(aMap) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } @@ -409,99 +436,115 @@ public class TestPlugin: NSObject, FlutterPlugin, HostIntegrationCoreApi { func callFlutterEcho(_ anEnum: AnEnum, completion: @escaping (Result<AnEnum, Error>) -> Void) { flutterAPI.echo(anEnum) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result<Bool?, Error>) -> Void) { + func callFlutterEchoNullable(_ aBool: Bool?, completion: @escaping (Result<Bool?, Error>) -> Void) + { flutterAPI.echoNullable(aBool) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ anInt: Int64?, completion: @escaping (Result<Int64?, Error>) -> Void) { + func callFlutterEchoNullable( + _ anInt: Int64?, completion: @escaping (Result<Int64?, Error>) -> Void + ) { flutterAPI.echoNullable(anInt) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aDouble: Double?, completion: @escaping (Result<Double?, Error>) -> Void) { + func callFlutterEchoNullable( + _ aDouble: Double?, completion: @escaping (Result<Double?, Error>) -> Void + ) { flutterAPI.echoNullable(aDouble) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aString: String?, completion: @escaping (Result<String?, Error>) -> Void) { + func callFlutterEchoNullable( + _ aString: String?, completion: @escaping (Result<String?, Error>) -> Void + ) { flutterAPI.echoNullable(aString) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - - func callFlutterEchoNullable(_ aList: FlutterStandardTypedData?, completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void) { + + func callFlutterEchoNullable( + _ aList: FlutterStandardTypedData?, + completion: @escaping (Result<FlutterStandardTypedData?, Error>) -> Void + ) { flutterAPI.echoNullable(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void) { + func callFlutterEchoNullable( + _ aList: [Any?]?, completion: @escaping (Result<[Any?]?, Error>) -> Void + ) { flutterAPI.echoNullable(aList) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterEchoNullable(_ aMap: [String? : Any?]?, completion: @escaping (Result<[String? : Any?]?, Error>) -> Void) { + func callFlutterEchoNullable( + _ aMap: [String?: Any?]?, completion: @escaping (Result<[String?: Any?]?, Error>) -> Void + ) { flutterAPI.echoNullable(aMap) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } } } - func callFlutterNullableEcho(_ anEnum: AnEnum?, completion: @escaping (Result<AnEnum?, Error>) -> Void) { + func callFlutterNullableEcho( + _ anEnum: AnEnum?, completion: @escaping (Result<AnEnum?, Error>) -> Void + ) { flutterAPI.echoNullable(anEnum) { response in switch response { - case .success(let res): - completion(.success(res)) - case .failure(let error): - completion(.failure(error)) + case .success(let res): + completion(.success(res)) + case .failure(let error): + completion(.failure(error)) } - } + } } } diff --git a/packages/platform/example/ios/Runner/AppDelegate.swift b/packages/platform/example/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/platform/example/ios/Runner/AppDelegate.swift +++ b/packages/platform/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/pointer_interceptor/pointer_interceptor/example/ios/Runner/AppDelegate.swift b/packages/pointer_interceptor/pointer_interceptor/example/ios/Runner/AppDelegate.swift index 41be7b255..8891e986b 100644 --- a/packages/pointer_interceptor/pointer_interceptor/example/ios/Runner/AppDelegate.swift +++ b/packages/pointer_interceptor/pointer_interceptor/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { @@ -13,12 +13,12 @@ import Flutter ) -> Bool { GeneratedPluginRegistrant.register(with: self) - weak var registrar = self.registrar(forPlugin: "DummyPlatform"); + weak var registrar = self.registrar(forPlugin: "DummyPlatform") let factory = DummyPlatformViewFactory(messenger: registrar!.messenger()) self.registrar(forPlugin: "<DummyPlatform>")!.register( - factory, - withId: "dummy_platform_view") + factory, + withId: "dummy_platform_view") return super.application(application, didFinishLaunchingWithOptions: launchOptions) } diff --git a/packages/pointer_interceptor/pointer_interceptor/example/ios/Runner/DummyPlatformViewFactory.swift b/packages/pointer_interceptor/pointer_interceptor/example/ios/Runner/DummyPlatformViewFactory.swift index 5ea634fa9..45f468b3a 100644 --- a/packages/pointer_interceptor/pointer_interceptor/example/ios/Runner/DummyPlatformViewFactory.swift +++ b/packages/pointer_interceptor/pointer_interceptor/example/ios/Runner/DummyPlatformViewFactory.swift @@ -5,9 +5,7 @@ import Flutter import UIKit -/** - * A simple factory that creates a dummy platform view for testing. - */ +/// A simple factory that creates a dummy platform view for testing. public class DummyPlatformViewFactory: NSObject, FlutterPlatformViewFactory { private var messenger: FlutterBinaryMessenger @@ -33,38 +31,34 @@ public class DummyPlatformViewFactory: NSObject, FlutterPlatformViewFactory { } } -/** - * A native view that will remove it's tag if clicked. - */ +/// A native view that will remove it's tag if clicked. public class CustomView: UIView { - var timesClicked = 0; + var timesClicked = 0 var nativeLabel = UILabel() override public func hitTest( _ point: CGPoint, with event: UIEvent? ) -> UIView? { - if (viewWithTag(1) != nil) { - viewWithTag(1)?.removeFromSuperview(); - createNativeView(view: self); + if viewWithTag(1) != nil { + viewWithTag(1)?.removeFromSuperview() + createNativeView(view: self) } - timesClicked += 1; + timesClicked += 1 nativeLabel.text = "Traversed \(timesClicked) subviews" return super.hitTest(point, with: event) } - func createNativeView(view _view: CustomView){ + func createNativeView(view _view: CustomView) { nativeLabel.text = "Traversed \(timesClicked) subviews" nativeLabel.frame = CGRect(x: 0, y: 0, width: 180, height: 48.0) _view.addSubview(nativeLabel) } } -/** - * A flutter platform view that displays a simple native view. - */ +/// A flutter platform view that displays a simple native view. class DummyPlatformView: NSObject, FlutterPlatformView { - private var _view: CustomView; + private var _view: CustomView init( frame: CGRect, @@ -81,9 +75,9 @@ class DummyPlatformView: NSObject, FlutterPlatformView { return _view } - func createNativeView(view _view: CustomView){ + func createNativeView(view _view: CustomView) { let nativeLabel = UILabel() - nativeLabel.tag = 1; + nativeLabel.tag = 1 nativeLabel.text = "Native View Not Clicked" nativeLabel.frame = CGRect(x: 0, y: 0, width: 180, height: 48.0) _view.addSubview(nativeLabel) diff --git a/packages/pointer_interceptor/pointer_interceptor_ios/example/ios/Runner/AppDelegate.swift b/packages/pointer_interceptor/pointer_interceptor_ios/example/ios/Runner/AppDelegate.swift index 41be7b255..8891e986b 100644 --- a/packages/pointer_interceptor/pointer_interceptor_ios/example/ios/Runner/AppDelegate.swift +++ b/packages/pointer_interceptor/pointer_interceptor_ios/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { @@ -13,12 +13,12 @@ import Flutter ) -> Bool { GeneratedPluginRegistrant.register(with: self) - weak var registrar = self.registrar(forPlugin: "DummyPlatform"); + weak var registrar = self.registrar(forPlugin: "DummyPlatform") let factory = DummyPlatformViewFactory(messenger: registrar!.messenger()) self.registrar(forPlugin: "<DummyPlatform>")!.register( - factory, - withId: "dummy_platform_view") + factory, + withId: "dummy_platform_view") return super.application(application, didFinishLaunchingWithOptions: launchOptions) } diff --git a/packages/pointer_interceptor/pointer_interceptor_ios/example/ios/Runner/DummyPlatformViewFactory.swift b/packages/pointer_interceptor/pointer_interceptor_ios/example/ios/Runner/DummyPlatformViewFactory.swift index 71b1bff63..5723fdac7 100644 --- a/packages/pointer_interceptor/pointer_interceptor_ios/example/ios/Runner/DummyPlatformViewFactory.swift +++ b/packages/pointer_interceptor/pointer_interceptor_ios/example/ios/Runner/DummyPlatformViewFactory.swift @@ -5,9 +5,7 @@ import Flutter import UIKit -/** - * A simple factory that creates a dummy platform view for testing. - */ +/// A simple factory that creates a dummy platform view for testing. public class DummyPlatformViewFactory: NSObject, FlutterPlatformViewFactory { private var messenger: FlutterBinaryMessenger @@ -33,25 +31,21 @@ public class DummyPlatformViewFactory: NSObject, FlutterPlatformViewFactory { } } -/** - * A native view that will remove its tag if clicked. - */ +/// A native view that will remove its tag if clicked. public class CustomView: UIView { override public func hitTest( _ point: CGPoint, with event: UIEvent? ) -> UIView? { - viewWithTag(1)?.removeFromSuperview(); + viewWithTag(1)?.removeFromSuperview() return super.hitTest(point, with: event) } } -/** - * A flutter platform view that displays a simple native view. - */ +/// A flutter platform view that displays a simple native view. class DummyPlatformView: NSObject, FlutterPlatformView { - private var _view: CustomView; + private var _view: CustomView init( frame: CGRect, @@ -68,10 +62,10 @@ class DummyPlatformView: NSObject, FlutterPlatformView { return _view } - func createNativeView(view _view: CustomView){ + func createNativeView(view _view: CustomView) { let nativeLabel = UILabel() _view.isUserInteractionEnabled = true - nativeLabel.tag = 1; + nativeLabel.tag = 1 nativeLabel.text = "Not Clicked" nativeLabel.frame = CGRect(x: 0, y: 0, width: 180, height: 48.0) _view.addSubview(nativeLabel) diff --git a/packages/quick_actions/quick_actions_ios/example/ios/RunnerUITests/RunnerUITests.swift b/packages/quick_actions/quick_actions_ios/example/ios/RunnerUITests/RunnerUITests.swift index 2ac4fdbc4..ad4c03f00 100644 --- a/packages/quick_actions/quick_actions_ios/example/ios/RunnerUITests/RunnerUITests.swift +++ b/packages/quick_actions/quick_actions_ios/example/ios/RunnerUITests/RunnerUITests.swift @@ -18,7 +18,7 @@ private let pressDurationRetryAdjustment: TimeInterval = 0.2 // This is to deflake a situation where the quick action menu is not present after // the long press. // See: https://github.com/flutter/flutter/issues/125509 -private let quickActionMaxRetries: Int = 4; +private let quickActionMaxRetries: Int = 4 class RunnerUITests: XCTestCase { @@ -40,7 +40,8 @@ class RunnerUITests: XCTestCase { let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard") let quickActionsAppIcon = springboard.icons["quick_actions_example"] - findAndTapQuickActionButton(buttonName: "Action two", quickActionsAppIcon: quickActionsAppIcon, springboard: springboard); + findAndTapQuickActionButton( + buttonName: "Action two", quickActionsAppIcon: quickActionsAppIcon, springboard: springboard) let actionTwoConfirmation = exampleApp.otherElements["action_two"] if !actionTwoConfirmation.waitForExistence(timeout: elementWaitingTime) { @@ -73,7 +74,8 @@ class RunnerUITests: XCTestCase { ) } - findAndTapQuickActionButton(buttonName: "Action one", quickActionsAppIcon: quickActionsAppIcon, springboard: springboard); + findAndTapQuickActionButton( + buttonName: "Action one", quickActionsAppIcon: quickActionsAppIcon, springboard: springboard) let actionOneConfirmation = exampleApp.otherElements["action_one"] if !actionOneConfirmation.waitForExistence(timeout: elementWaitingTime) { @@ -85,7 +87,9 @@ class RunnerUITests: XCTestCase { XCTAssert(actionOneConfirmation.exists) } - private func findAndTapQuickActionButton(buttonName: String, quickActionsAppIcon: XCUIElement, springboard: XCUIElement) { + private func findAndTapQuickActionButton( + buttonName: String, quickActionsAppIcon: XCUIElement, springboard: XCUIElement + ) { var actionButton: XCUIElement? var pressDuration = quickActionPressDuration for _ in 1...quickActionMaxRetries { @@ -111,12 +115,12 @@ class RunnerUITests: XCTestCase { // Reset to previous state. XCUIDevice.shared.press(XCUIDevice.Button.home) } - if (!actionButton!.exists) { + if !actionButton!.exists { XCTFail( "Failed due to not able to find the \(buttonName) button from springboard with \(elementWaitingTime) seconds. Springboard debug description: \(springboard.debugDescription)" ) } - actionButton!.tap(); + actionButton!.tap() } } diff --git a/packages/quick_actions/quick_actions_ios/ios/Classes/messages.g.swift b/packages/quick_actions/quick_actions_ios/ios/Classes/messages.g.swift index 0dec7a619..ed2b58280 100644 --- a/packages/quick_actions/quick_actions_ios/ios/Classes/messages.g.swift +++ b/packages/quick_actions/quick_actions_ios/ios/Classes/messages.g.swift @@ -5,12 +5,13 @@ // See also: https://pub.dev/packages/pigeon import Foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #else -#error("Unsupported platform.") + #error("Unsupported platform.") #endif extension FlutterError: Error {} @@ -28,13 +29,13 @@ private func wrapError(_ error: Any) -> [Any?] { return [ flutterError.code, flutterError.message, - flutterError.details + flutterError.details, ] } return [ "\(error)", "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)" + "Stacktrace: \(Thread.callStackSymbols)", ] } @@ -76,10 +77,10 @@ struct ShortcutItemMessage { private class IOSQuickActionsApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return ShortcutItemMessage.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) + case 128: + return ShortcutItemMessage.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) } } } @@ -124,7 +125,9 @@ class IOSQuickActionsApiSetup { /// Sets up an instance of `IOSQuickActionsApi` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: IOSQuickActionsApi?) { /// Sets the dynamic shortcuts for the app. - let setShortcutItemsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsApi.setShortcutItems", binaryMessenger: binaryMessenger, codec: codec) + let setShortcutItemsChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsApi.setShortcutItems", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setShortcutItemsChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -140,7 +143,9 @@ class IOSQuickActionsApiSetup { setShortcutItemsChannel.setMessageHandler(nil) } /// Removes all dynamic shortcuts. - let clearShortcutItemsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsApi.clearShortcutItems", binaryMessenger: binaryMessenger, codec: codec) + let clearShortcutItemsChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsApi.clearShortcutItems", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { clearShortcutItemsChannel.setMessageHandler { _, reply in do { @@ -158,16 +163,21 @@ class IOSQuickActionsApiSetup { /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol IOSQuickActionsFlutterApiProtocol { /// Sends a string representing a shortcut from the native platform to the app. - func launchAction(action actionArg: String, completion: @escaping (Result<Void, FlutterError>) -> Void) + func launchAction( + action actionArg: String, completion: @escaping (Result<Void, FlutterError>) -> Void) } class IOSQuickActionsFlutterApi: IOSQuickActionsFlutterApiProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger){ + init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } /// Sends a string representing a shortcut from the native platform to the app. - func launchAction(action actionArg: String, completion: @escaping (Result<Void, FlutterError>) -> Void) { - let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsFlutterApi.launchAction", binaryMessenger: binaryMessenger) + func launchAction( + action actionArg: String, completion: @escaping (Result<Void, FlutterError>) -> Void + ) { + let channel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsFlutterApi.launchAction", + binaryMessenger: binaryMessenger) channel.sendMessage([actionArg] as [Any?]) { _ in completion(.success(Void())) } diff --git a/packages/rfw/example/hello/ios/Runner/AppDelegate.swift b/packages/rfw/example/hello/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/rfw/example/hello/ios/Runner/AppDelegate.swift +++ b/packages/rfw/example/hello/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/rfw/example/local/ios/Runner/AppDelegate.swift b/packages/rfw/example/local/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/rfw/example/local/ios/Runner/AppDelegate.swift +++ b/packages/rfw/example/local/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/rfw/example/remote/ios/Runner/AppDelegate.swift b/packages/rfw/example/remote/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/rfw/example/remote/ios/Runner/AppDelegate.swift +++ b/packages/rfw/example/remote/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/shared_preferences/shared_preferences/example/ios/Runner/AppDelegate.swift b/packages/shared_preferences/shared_preferences/example/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/shared_preferences/shared_preferences/example/ios/Runner/AppDelegate.swift +++ b/packages/shared_preferences/shared_preferences/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/shared_preferences/shared_preferences_foundation/darwin/Classes/SharedPreferencesPlugin.swift b/packages/shared_preferences/shared_preferences_foundation/darwin/Classes/SharedPreferencesPlugin.swift index fcfe97e56..b88562e83 100644 --- a/packages/shared_preferences/shared_preferences_foundation/darwin/Classes/SharedPreferencesPlugin.swift +++ b/packages/shared_preferences/shared_preferences_foundation/darwin/Classes/SharedPreferencesPlugin.swift @@ -5,24 +5,24 @@ import Foundation #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #endif public class SharedPreferencesPlugin: NSObject, FlutterPlugin, UserDefaultsApi { public static func register(with registrar: FlutterPluginRegistrar) { let instance = SharedPreferencesPlugin() // Workaround for https://github.com/flutter/flutter/issues/118103. -#if os(iOS) - let messenger = registrar.messenger() -#else - let messenger = registrar.messenger -#endif + #if os(iOS) + let messenger = registrar.messenger() + #else + let messenger = registrar.messenger + #endif UserDefaultsApiSetup.setUp(binaryMessenger: messenger, api: instance) } - func getAll(prefix: String, allowList: [String]?) -> [String? : Any?] { + func getAll(prefix: String, allowList: [String]?) -> [String?: Any?] { return getAllPrefs(prefix: prefix, allowList: allowList) } @@ -47,21 +47,22 @@ public class SharedPreferencesPlugin: NSObject, FlutterPlugin, UserDefaultsApi { for (key, _) in getAllPrefs(prefix: prefix, allowList: allowList) { defaults.removeObject(forKey: key) } - return true + return true } /// Returns all preferences stored with specified prefix. /// If [allowList] is included, only items included will be returned. func getAllPrefs(prefix: String, allowList: [String]?) -> [String: Any] { var filteredPrefs: [String: Any] = [:] - var allowSet: Set<String>?; + var allowSet: Set<String>? if let allowList = allowList { allowSet = Set(allowList) } if let appDomain = Bundle.main.bundleIdentifier, let prefs = UserDefaults.standard.persistentDomain(forName: appDomain) { - for (key, value) in prefs where (key.hasPrefix(prefix) && (allowSet == nil || allowSet!.contains(key))) { + for (key, value) in prefs + where (key.hasPrefix(prefix) && (allowSet == nil || allowSet!.contains(key))) { filteredPrefs[key] = value } } diff --git a/packages/shared_preferences/shared_preferences_foundation/darwin/Tests/RunnerTests.swift b/packages/shared_preferences/shared_preferences_foundation/darwin/Tests/RunnerTests.swift index 64dd646ef..42a1d00d8 100644 --- a/packages/shared_preferences/shared_preferences_foundation/darwin/Tests/RunnerTests.swift +++ b/packages/shared_preferences/shared_preferences_foundation/darwin/Tests/RunnerTests.swift @@ -4,14 +4,14 @@ import XCTest +@testable import shared_preferences_foundation + #if os(iOS) -import Flutter + import Flutter #elseif os(macOS) -import FlutterMacOS + import FlutterMacOS #endif -@testable import shared_preferences_foundation - class RunnerTests: XCTestCase { let prefixes: [String] = ["aPrefix", ""] @@ -30,7 +30,7 @@ class RunnerTests: XCTestCase { XCTAssertEqual(storedValues["\(aPrefix)aDouble"] as! Double, 3.14, accuracy: 0.0001) XCTAssertEqual(storedValues["\(aPrefix)anInt"] as? Int, 42) XCTAssertEqual(storedValues["\(aPrefix)aString"] as? String, "hello world") - XCTAssertEqual(storedValues["\(aPrefix)aStringList"] as? Array<String>, ["hello", "world"]) + XCTAssertEqual(storedValues["\(aPrefix)aStringList"] as? [String], ["hello", "world"]) } } @@ -70,40 +70,40 @@ class RunnerTests: XCTestCase { XCTAssertNil(finalValues[testKey] as Any?) } } - - func testClearWithNoAllowlist() throws { - for aPrefix in prefixes { - let plugin = SharedPreferencesPlugin() - let testKey = "\(aPrefix)foo" - plugin.setValue(key: testKey, value: 42) - - // Make sure there is something to clear, so the test can't pass due to a set failure. - let preRemovalValues = plugin.getAll(prefix: aPrefix, allowList: nil) - XCTAssertEqual(preRemovalValues[testKey] as? Int, 42) - - // Then verify that clearing works. - plugin.clear(prefix: aPrefix, allowList: nil) - - let finalValues = plugin.getAll(prefix: aPrefix, allowList: nil) - XCTAssertNil(finalValues[testKey] as Any?) - } + + func testClearWithNoAllowlist() throws { + for aPrefix in prefixes { + let plugin = SharedPreferencesPlugin() + let testKey = "\(aPrefix)foo" + plugin.setValue(key: testKey, value: 42) + + // Make sure there is something to clear, so the test can't pass due to a set failure. + let preRemovalValues = plugin.getAll(prefix: aPrefix, allowList: nil) + XCTAssertEqual(preRemovalValues[testKey] as? Int, 42) + + // Then verify that clearing works. + plugin.clear(prefix: aPrefix, allowList: nil) + + let finalValues = plugin.getAll(prefix: aPrefix, allowList: nil) + XCTAssertNil(finalValues[testKey] as Any?) } - - func testClearWithAllowlist() throws { - for aPrefix in prefixes { - let plugin = SharedPreferencesPlugin() - let testKey = "\(aPrefix)foo" - plugin.setValue(key: testKey, value: 42) - - // Make sure there is something to clear, so the test can't pass due to a set failure. - let preRemovalValues = plugin.getAll(prefix: aPrefix, allowList: nil) - XCTAssertEqual(preRemovalValues[testKey] as? Int, 42) - - plugin.clear(prefix: aPrefix, allowList: ["\(aPrefix)notfoo"]) - - let finalValues = plugin.getAll(prefix: aPrefix, allowList: nil) - XCTAssertEqual(finalValues[testKey] as? Int, 42) - } + } + + func testClearWithAllowlist() throws { + for aPrefix in prefixes { + let plugin = SharedPreferencesPlugin() + let testKey = "\(aPrefix)foo" + plugin.setValue(key: testKey, value: 42) + + // Make sure there is something to clear, so the test can't pass due to a set failure. + let preRemovalValues = plugin.getAll(prefix: aPrefix, allowList: nil) + XCTAssertEqual(preRemovalValues[testKey] as? Int, 42) + + plugin.clear(prefix: aPrefix, allowList: ["\(aPrefix)notfoo"]) + + let finalValues = plugin.getAll(prefix: aPrefix, allowList: nil) + XCTAssertEqual(finalValues[testKey] as? Int, 42) } - + } + } diff --git a/packages/shared_preferences/shared_preferences_foundation/example/ios/Runner/AppDelegate.swift b/packages/shared_preferences/shared_preferences_foundation/example/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/shared_preferences/shared_preferences_foundation/example/ios/Runner/AppDelegate.swift +++ b/packages/shared_preferences/shared_preferences_foundation/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/two_dimensional_scrollables/example/ios/Runner/AppDelegate.swift b/packages/two_dimensional_scrollables/example/ios/Runner/AppDelegate.swift index caf998393..d83c0ff0b 100644 --- a/packages/two_dimensional_scrollables/example/ios/Runner/AppDelegate.swift +++ b/packages/two_dimensional_scrollables/example/ios/Runner/AppDelegate.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/packages/two_dimensional_scrollables/example/macos/RunnerTests/RunnerTests.swift b/packages/two_dimensional_scrollables/example/macos/RunnerTests/RunnerTests.swift index de34867ba..6a4e9ea78 100644 --- a/packages/two_dimensional_scrollables/example/macos/RunnerTests/RunnerTests.swift +++ b/packages/two_dimensional_scrollables/example/macos/RunnerTests/RunnerTests.swift @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import FlutterMacOS import Cocoa +import FlutterMacOS import XCTest class RunnerTests: XCTestCase { DONE