@@ -34,7 +34,9 @@ private func wrapError(_ error: Any) -> [Any?] {
3434}
3535
3636private func createConnectionError( withChannelName channelName: String ) -> FlutterError {
37- return FlutterError ( code: " channel-error " , message: " Unable to establish connection on channel: ' \( channelName) '. " , details: " " )
37+ return FlutterError (
38+ code: " channel-error " , message: " Unable to establish connection on channel: ' \( channelName) '. " ,
39+ details: " " )
3840}
3941
4042private func isNullish( _ value: Any ? ) -> Bool {
@@ -130,7 +132,9 @@ class ExampleHostApiSetup {
130132 static var codec : FlutterStandardMessageCodec { ExampleHostApiCodec . shared }
131133 /// Sets up an instance of `ExampleHostApi` to handle messages through the `binaryMessenger`.
132134 static func setUp( binaryMessenger: FlutterBinaryMessenger , api: ExampleHostApi ? ) {
133- let getHostLanguageChannel = FlutterBasicMessageChannel ( name: " dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.getHostLanguage " , binaryMessenger: binaryMessenger, codec: codec)
135+ let getHostLanguageChannel = FlutterBasicMessageChannel (
136+ name: " dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.getHostLanguage " ,
137+ binaryMessenger: binaryMessenger, codec: codec)
134138 if let api = api {
135139 getHostLanguageChannel. setMessageHandler { _, reply in
136140 do {
@@ -143,7 +147,9 @@ class ExampleHostApiSetup {
143147 } else {
144148 getHostLanguageChannel. setMessageHandler ( nil )
145149 }
146- let addChannel = FlutterBasicMessageChannel ( name: " dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.add " , binaryMessenger: binaryMessenger, codec: codec)
150+ let addChannel = FlutterBasicMessageChannel (
151+ name: " dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.add " ,
152+ binaryMessenger: binaryMessenger, codec: codec)
147153 if let api = api {
148154 addChannel. setMessageHandler { message, reply in
149155 let args = message as! [ Any ? ]
@@ -159,7 +165,9 @@ class ExampleHostApiSetup {
159165 } else {
160166 addChannel. setMessageHandler ( nil )
161167 }
162- let sendMessageChannel = FlutterBasicMessageChannel ( name: " dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.sendMessage " , binaryMessenger: binaryMessenger, codec: codec)
168+ let sendMessageChannel = FlutterBasicMessageChannel (
169+ name: " dev.flutter.pigeon.pigeon_example_package.ExampleHostApi.sendMessage " ,
170+ binaryMessenger: binaryMessenger, codec: codec)
163171 if let api = api {
164172 sendMessageChannel. setMessageHandler { message, reply in
165173 let args = message as! [ Any ? ]
@@ -180,15 +188,19 @@ class ExampleHostApiSetup {
180188}
181189/// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift.
182190protocol MessageFlutterApiProtocol {
183- func flutterMethod( aString aStringArg: String ? , completion: @escaping ( Result < String , FlutterError > ) -> Void )
191+ func flutterMethod(
192+ aString aStringArg: String ? , completion: @escaping ( Result < String , FlutterError > ) -> Void )
184193}
185194class MessageFlutterApi : MessageFlutterApiProtocol {
186195 private let binaryMessenger : FlutterBinaryMessenger
187196 init ( binaryMessenger: FlutterBinaryMessenger ) {
188197 self . binaryMessenger = binaryMessenger
189198 }
190- func flutterMethod( aString aStringArg: String ? , completion: @escaping ( Result < String , FlutterError > ) -> Void ) {
191- let channelName : String = " dev.flutter.pigeon.pigeon_example_package.MessageFlutterApi.flutterMethod "
199+ func flutterMethod(
200+ aString aStringArg: String ? , completion: @escaping ( Result < String , FlutterError > ) -> Void
201+ ) {
202+ let channelName : String =
203+ " dev.flutter.pigeon.pigeon_example_package.MessageFlutterApi.flutterMethod "
192204 let channel = FlutterBasicMessageChannel ( name: channelName, binaryMessenger: binaryMessenger)
193205 channel. sendMessage ( [ aStringArg] as [ Any ? ] ) { response in
194206 guard let listResponse = response as? [ Any ? ] else {
@@ -201,7 +213,11 @@ class MessageFlutterApi: MessageFlutterApiProtocol {
201213 let details : String ? = nilOrValue ( listResponse [ 2 ] )
202214 completion ( . failure( FlutterError ( code: code, message: message, details: details) ) )
203215 } else if listResponse [ 0 ] == nil {
204- completion ( . failure( FlutterError ( code: " null-error " , message: " Flutter api returned null value for non-null return value. " , details: " " ) ) )
216+ completion (
217+ . failure(
218+ FlutterError (
219+ code: " null-error " ,
220+ message: " Flutter api returned null value for non-null return value. " , details: " " ) ) )
205221 } else {
206222 let result = listResponse [ 0 ] as! String
207223 completion ( . success( result) )
0 commit comments