88#import " FlutterBinaryMessenger.h"
99#import " FlutterCodecs.h"
1010
11+ @protocol FlutterTaskQueue;
12+
1113NS_ASSUME_NONNULL_BEGIN
1214/* *
1315 * A message reply callback.
@@ -24,7 +26,8 @@ typedef void (^FlutterReply)(id _Nullable reply);
2426 * asynchronous replies back to Flutter.
2527 *
2628 * @param message The message.
27- * @param callback A callback for submitting a reply to the sender.
29+ * @param callback A callback for submitting a reply to the sender which can be invoked from any
30+ * thread.
2831 */
2932typedef void (^FlutterMessageHandler)(id _Nullable message, FlutterReply callback);
3033
@@ -88,6 +91,27 @@ FLUTTER_DARWIN_EXPORT
8891 binaryMessenger : (NSObject <FlutterBinaryMessenger>*)messenger
8992 codec : (NSObject <FlutterMessageCodec>*)codec ;
9093
94+ /* *
95+ * Initializes a `FlutterBasicMessageChannel` with the specified name, binary
96+ * messenger, and message codec.
97+ *
98+ * The channel name logically identifies the channel; identically named channels
99+ * interfere with each other's communication.
100+ *
101+ * The binary messenger is a facility for sending raw, binary messages to the
102+ * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`.
103+ *
104+ * @param name The channel name.
105+ * @param messenger The binary messenger.
106+ * @param codec The message codec.
107+ * @param taskQueue The FlutterTaskQueue that executes the handler (see
108+ -[FlutterBinaryMessenger makeBackgroundTaskQueue]).
109+ */
110+ - (instancetype )initWithName : (NSString *)name
111+ binaryMessenger : (NSObject <FlutterBinaryMessenger>*)messenger
112+ codec : (NSObject <FlutterMessageCodec>*)codec
113+ taskQueue : (NSObject <FlutterTaskQueue>* _Nullable)taskQueue ;
114+
91115/* *
92116 * Sends the specified message to the Flutter side, ignoring any reply.
93117 *
@@ -142,7 +166,7 @@ typedef void (^FlutterResult)(id _Nullable result);
142166 * Invoke the callback with a `FlutterError` to indicate that the call failed.
143167 * Invoke the callback with `FlutterMethodNotImplemented` to indicate that the
144168 * method was unknown. Any other values, including `nil`, are interpreted as
145- * successful results.
169+ * successful results. This can be invoked from any thread.
146170 */
147171typedef void (^FlutterMethodCallHandler)(FlutterMethodCall* call, FlutterResult result);
148172
@@ -213,6 +237,27 @@ FLUTTER_DARWIN_EXPORT
213237 binaryMessenger : (NSObject <FlutterBinaryMessenger>*)messenger
214238 codec : (NSObject <FlutterMethodCodec>*)codec ;
215239
240+ /* *
241+ * Initializes a `FlutterMethodChannel` with the specified name, binary messenger,
242+ * method codec, and task queue.
243+ *
244+ * The channel name logically identifies the channel; identically named channels
245+ * interfere with each other's communication.
246+ *
247+ * The binary messenger is a facility for sending raw, binary messages to the
248+ * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`.
249+ *
250+ * @param name The channel name.
251+ * @param messenger The binary messenger.
252+ * @param codec The method codec.
253+ * @param taskQueue The FlutterTaskQueue that executes the handler (see
254+ -[FlutterBinaryMessenger makeBackgroundTaskQueue]).
255+ */
256+ - (instancetype )initWithName : (NSString *)name
257+ binaryMessenger : (NSObject <FlutterBinaryMessenger>*)messenger
258+ codec : (NSObject <FlutterMethodCodec>*)codec
259+ taskQueue : (NSObject <FlutterTaskQueue>* _Nullable)taskQueue ;
260+
216261// clang-format off
217262/* *
218263 * Invokes the specified Flutter method with the specified arguments, expecting
@@ -371,6 +416,27 @@ FLUTTER_DARWIN_EXPORT
371416- (instancetype )initWithName : (NSString *)name
372417 binaryMessenger : (NSObject <FlutterBinaryMessenger>*)messenger
373418 codec : (NSObject <FlutterMethodCodec>*)codec ;
419+
420+ /* *
421+ * Initializes a `FlutterEventChannel` with the specified name, binary messenger,
422+ * method codec and task queue.
423+ *
424+ * The channel name logically identifies the channel; identically named channels
425+ * interfere with each other's communication.
426+ *
427+ * The binary messenger is a facility for sending raw, binary messages to the
428+ * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`.
429+ *
430+ * @param name The channel name.
431+ * @param messenger The binary messenger.
432+ * @param codec The method codec.
433+ * @param taskQueue The FlutterTaskQueue that executes the handler (see
434+ -[FlutterBinaryMessenger makeBackgroundTaskQueue]).
435+ */
436+ - (instancetype )initWithName : (NSString *)name
437+ binaryMessenger : (NSObject <FlutterBinaryMessenger>*)messenger
438+ codec : (NSObject <FlutterMethodCodec>*)codec
439+ taskQueue : (NSObject <FlutterTaskQueue>* _Nullable)taskQueue ;
374440/* *
375441 * Registers a handler for stream setup requests from the Flutter side.
376442 *
0 commit comments