FlutterBinaryMessenger
@protocol FlutterBinaryMessenger <NSObject>
A facility for communicating with the Flutter side using asynchronous message passing with binary messages.
Implementated by:
FlutterBasicMessageChannel
, which supports communication using structured messages.FlutterMethodChannel
, which supports communication using asynchronous method calls.FlutterEventChannel
, which supports commuication using event streams.
-
Sends a binary message to the Flutter side on the specified channel, expecting no reply.
Declaration
Objective-C
- (void)sendOnChannel:(nonnull NSString *)channel message:(NSData *_Nullable)message;
Parameters
channel
The channel name.
message
The message.
-
Sends a binary message to the Flutter side on the specified channel, expecting an asynchronous reply.
Declaration
Objective-C
- (void)sendOnChannel:(nonnull NSString *)channel message:(NSData *_Nullable)message binaryReply:(FlutterBinaryReply _Nullable)callback;
Parameters
channel
The channel name.
message
The message.
callback
A callback for receiving a reply.
-
Registers a message handler for incoming binary messages from the Flutter side on the specified channel.
Replaces any existing handler. Use a
nil
handler for unregistering the existing handler.Declaration
Objective-C
- (void)setMessageHandlerOnChannel:(nonnull NSString *)channel binaryMessageHandler: (FlutterBinaryMessageHandler _Nullable)handler;
Parameters
channel
The channel name.
handler
The message handler.