FlutterBasicMessageChannel
@interface FlutterBasicMessageChannel : NSObject
A channel for communicating with the Flutter side using basic, asynchronous message passing.
-
Creates a
FlutterBasicMessageChannelwith the specified name and binary messenger.The channel name logically identifies the channel; identically named channels interfere with each other’s communication.
The binary messenger is a facility for sending raw, binary messages to the Flutter side. This protocol is implemented by
FlutterEngineandFlutterViewController.The channel uses
FlutterStandardMessageCodecto encode and decode messages.Declaration
Objective-C
+ (nonnull instancetype)messageChannelWithName:(nonnull NSString *)name binaryMessenger: (nonnull NSObject<FlutterBinaryMessenger> *) messenger;Parameters
nameThe channel name.
messengerThe binary messenger.
-
Creates a
FlutterBasicMessageChannelwith the specified name, binary messenger, and message codec.The channel name logically identifies the channel; identically named channels interfere with each other’s communication.
The binary messenger is a facility for sending raw, binary messages to the Flutter side. This protocol is implemented by
FlutterEngineandFlutterViewController.Declaration
Objective-C
+ (nonnull instancetype) messageChannelWithName:(nonnull NSString *)name binaryMessenger:(nonnull NSObject<FlutterBinaryMessenger> *)messenger codec:(nonnull NSObject<FlutterMessageCodec> *)codec;Parameters
nameThe channel name.
messengerThe binary messenger.
codecThe message codec.
-
Initializes a
FlutterBasicMessageChannelwith the specified name, binary messenger, and message codec.The channel name logically identifies the channel; identically named channels interfere with each other’s communication.
The binary messenger is a facility for sending raw, binary messages to the Flutter side. This protocol is implemented by
FlutterEngineandFlutterViewController.Declaration
Objective-C
- (nonnull instancetype) initWithName:(nonnull NSString *)name binaryMessenger:(nonnull NSObject<FlutterBinaryMessenger> *)messenger codec:(nonnull NSObject<FlutterMessageCodec> *)codec;Parameters
nameThe channel name.
messengerThe binary messenger.
codecThe message codec.
-
Initializes a
FlutterBasicMessageChannelwith the specified name, binary messenger, and message codec.The channel name logically identifies the channel; identically named channels interfere with each other’s communication.
The binary messenger is a facility for sending raw, binary messages to the Flutter side. This protocol is implemented by
FlutterEngineandFlutterViewController.Declaration
Objective-C
- (nonnull instancetype) initWithName:(nonnull NSString *)name binaryMessenger:(nonnull NSObject<FlutterBinaryMessenger> *)messenger codec:(nonnull NSObject<FlutterMessageCodec> *)codec taskQueue:(NSObject<FlutterTaskQueue> *_Nullable)taskQueue;Parameters
nameThe channel name.
messengerThe binary messenger.
codecThe message codec.
taskQueueThe FlutterTaskQueue that executes the handler (see -[FlutterBinaryMessenger makeBackgroundTaskQueue]).
-
Sends the specified message to the Flutter side, ignoring any reply.
Declaration
Objective-C
- (void)sendMessage:(id _Nullable)message;Parameters
messageThe message. Must be supported by the codec of this channel.
-
Sends the specified message to the Flutter side, expecting an asynchronous reply.
Declaration
Objective-C
- (void)sendMessage:(id _Nullable)message reply:(FlutterReply _Nullable)callback;Parameters
messageThe message. Must be supported by the codec of this channel.
callbackA callback to be invoked with the message reply from Flutter.
-
Registers a message handler with this channel.
Replaces any existing handler. Use a
nilhandler for unregistering the existing handler.Declaration
Objective-C
- (void)setMessageHandler:(FlutterMessageHandler _Nullable)handler;Parameters
handlerThe message handler.
-
Adjusts the number of messages that will get buffered when sending messages to channels that aren’t fully set up yet. For example, the engine isn’t running yet or the channel’s message handler isn’t set up on the Dart side yet.
Declaration
Objective-C
- (void)resizeChannelBuffer:(NSInteger)newSize;
View on GitHub
Install in Dash
FlutterBasicMessageChannel Class Reference