#import <FlutterChannels.h>
Instance Methods | |
(instancetype) | - initWithName:binaryMessenger:codec: |
(instancetype) | - initWithName:binaryMessenger:codec:taskQueue: |
(void) | - sendMessage: |
(void) | - sendMessage:reply: |
(void) | - setMessageHandler: |
(void) | - resizeChannelBuffer: |
(void) | - setWarnsOnOverflow: |
Class Methods | |
(instancetype) | + messageChannelWithName:binaryMessenger: |
(instancetype) | + messageChannelWithName:binaryMessenger:codec: |
(void) | + resizeChannelWithName:binaryMessenger:size: |
(void) | + setWarnsOnOverflow:forChannelWithName:binaryMessenger: |
A channel for communicating with the Flutter side using basic, asynchronous message passing.
Definition at line 37 of file FlutterChannels.h.
- (instancetype) initWithName: | (NSString*) | name | |
binaryMessenger: | (NSObject<FlutterBinaryMessenger>*) | messenger | |
codec: | (NSObject<FlutterMessageCodec>*) | codec | |
Initializes a FlutterBasicMessageChannel
with 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 FlutterEngine
and FlutterViewController
.
name | The channel name. |
messenger | The binary messenger. |
codec | The message codec. |
Definition at line 90 of file FlutterChannels.mm.
References initWithName:binaryMessenger:codec:taskQueue:.
- (instancetype) initWithName: | (NSString *) | name | |
binaryMessenger: | (NSObject< FlutterBinaryMessenger > *) | messenger | |
codec: | (NSObject< FlutterMessageCodec > *) | codec | |
taskQueue: | (NSObject< FlutterTaskQueue > *_Nullable) | taskQueue | |
Initializes a FlutterBasicMessageChannel
with 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 FlutterEngine
and FlutterViewController
.
name | The channel name. |
messenger | The binary messenger. |
codec | The message codec. |
taskQueue | The FlutterTaskQueue that executes the handler (see -[FlutterBinaryMessenger makeBackgroundTaskQueue]). |
Referenced by initWithName:binaryMessenger:codec:.
+ (instancetype) messageChannelWithName: | (NSString*) | name | |
binaryMessenger: | (NSObject<FlutterBinaryMessenger>*) | messenger | |
Creates a FlutterBasicMessageChannel
with 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 FlutterEngine
and FlutterViewController
.
The channel uses FlutterStandardMessageCodec
to encode and decode messages.
name | The channel name. |
messenger | The binary messenger. |
Definition at line 75 of file FlutterChannels.mm.
References messageChannelWithName:binaryMessenger:codec:, and <FlutterMessageCodec>::sharedInstance.
+ (instancetype) messageChannelWithName: | (NSString*) | name | |
binaryMessenger: | (NSObject<FlutterBinaryMessenger>*) | messenger | |
codec: | (NSObject<FlutterMessageCodec>*) | codec | |
Creates a FlutterBasicMessageChannel
with 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 FlutterEngine
and FlutterViewController
.
name | The channel name. |
messenger | The binary messenger. |
codec | The message codec. |
Definition at line 82 of file FlutterChannels.mm.
Referenced by FlutterKeyboardManager::initWithViewDelegate:, and messageChannelWithName:binaryMessenger:.
- (void) resizeChannelBuffer: | (NSInteger) | newSize |
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.
newSize | The number of messages that will get buffered. |
Definition at line 152 of file FlutterChannels.mm.
References _name, and ResizeChannelBuffer().
+ (void) resizeChannelWithName: | (NSString*) | name | |
binaryMessenger: | (NSObject<FlutterBinaryMessenger>*) | messenger | |
size: | (NSInteger) | newSize | |
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.
name | The channel name. |
messenger | The binary messenger. |
newSize | The number of messages that will get buffered. |
Definition at line 146 of file FlutterChannels.mm.
References ResizeChannelBuffer().
- (void) sendMessage: | (id _Nullable) | message |
Sends the specified message to the Flutter side, ignoring any reply.
message | The message. Must be supported by the codec of this channel. |
Reimplemented in FakeMessageChannel.
- (void) sendMessage: | (id _Nullable) | message | |
reply: | (FlutterReply _Nullable) | callback | |
Sends the specified message to the Flutter side, expecting an asynchronous reply.
message | The message. Must be supported by the codec of this channel. |
callback | A callback to be invoked with the message reply from Flutter. |
Reimplemented in FakeMessageChannel.
- (void) setMessageHandler: | (FlutterMessageHandler _Nullable) | handler |
Registers a message handler with this channel.
Replaces any existing handler. Use a nil
handler for unregistering the existing handler.
handler | The message handler. |
Referenced by flutter::testing::TEST_F().
- (void) setWarnsOnOverflow: | (BOOL) | warns |
Defines whether the channel should show warning messages when discarding messages due to overflow.
warns | When false, the channel is expected to overflow and warning messages will not be shown. |
Definition at line 162 of file FlutterChannels.mm.
References _name, and SetWarnsOnOverflow().
+ (void) setWarnsOnOverflow: | (BOOL) | warns | |
forChannelWithName: | (NSString*) | name | |
binaryMessenger: | (NSObject<FlutterBinaryMessenger>*) | messenger | |
Defines whether the channel should show warning messages when discarding messages due to overflow.
warns | When false, the channel is expected to overflow and warning messages will not be shown. |
name | The channel name. |
messenger | The binary messenger. |
Definition at line 156 of file FlutterChannels.mm.
References SetWarnsOnOverflow().