Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Instance Methods | Properties | List of all members
MockBinaryMessenger Class Reference
Inheritance diagram for MockBinaryMessenger:
<FlutterBinaryMessenger>

Instance Methods

(instancetype) - init [implementation]
 
(void) - sendOnChannel:message: [implementation]
 
(void) - sendOnChannel:message:binaryReply: [implementation]
 
(FlutterBinaryMessengerConnection- setMessageHandlerOnChannel:binaryMessageHandler: [implementation]
 
(void) - cleanUpConnection: [implementation]
 
- Instance Methods inherited from <FlutterBinaryMessenger>
(NSObject< FlutterTaskQueue > *) - makeBackgroundTaskQueue
 TODO(gaaclarke): Remove optional when macos supports Background Platform Channels.
 
(FlutterBinaryMessengerConnection- setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:
 

Properties

NSString * channel
 
NSData * message
 
NSMutableDictionary< NSString *, FlutterBinaryMessageHandler > * handlers
 

Detailed Description

Definition at line 13 of file FlutterChannelsTest.m.

Method Documentation

◆ cleanUpConnection:

- (void) cleanUpConnection: (FlutterBinaryMessengerConnection connection
implementation

Clears out a channel's message handler if that handler is still the one that was created as a result of setMessageHandlerOnChannel:binaryMessageHandler:.

Parameters
connectionThe result from setMessageHandlerOnChannel:binaryMessageHandler:.

Reimplemented from <FlutterBinaryMessenger>.

Definition at line 16 of file FlutterChannelsTest.m.

46}
int64_t FlutterBinaryMessengerConnection

◆ init

- (instancetype) init
implementation

Definition at line 16 of file FlutterChannelsTest.m.

19 {
20 self = [super init];
21 if (self) {
22 _handlers = [[NSMutableDictionary<NSString*, FlutterBinaryMessageHandler> alloc] init];
23 }
24 return self;
25}

◆ sendOnChannel:message:

- (void) sendOnChannel: (NSString *)  channel
message: (NSData *_Nullable)  message 
implementation

Sends a binary message to the Flutter side on the specified channel, expecting no reply.

Parameters
channelThe channel name.
messageThe message.

Reimplemented from <FlutterBinaryMessenger>.

Definition at line 16 of file FlutterChannelsTest.m.

27 :(NSString*)channel message:(NSData* _Nullable)message {
28 [self sendOnChannel:channel message:message binaryReply:nil];
29}

◆ sendOnChannel:message:binaryReply:

- (void) sendOnChannel: (NSString *)  channel
message: (NSData *_Nullable)  message
binaryReply: (FlutterBinaryReply _Nullable)  callback 
implementation

Sends a binary message to the Flutter side on the specified channel, expecting an asynchronous reply.

Parameters
channelThe channel name.
messageThe message.
callbackA callback for receiving a reply.

Reimplemented from <FlutterBinaryMessenger>.

Definition at line 16 of file FlutterChannelsTest.m.

31 :(NSString*)channel
32 message:(NSData* _Nullable)message
33 binaryReply:(FlutterBinaryReply _Nullable)callback {
35 self.message = message;
36}
NS_ASSUME_NONNULL_BEGIN typedef void(^ FlutterBinaryReply)(NSData *_Nullable reply)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ setMessageHandlerOnChannel:binaryMessageHandler:

- (FlutterBinaryMessengerConnection) setMessageHandlerOnChannel: (NSString *)  channel
binaryMessageHandler: (FlutterBinaryMessageHandler _Nullable)  handler 
implementation

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.

Parameters
channelThe channel name.
handlerThe message handler.
Returns
An identifier that represents the connection that was just created to the channel.

Reimplemented from <FlutterBinaryMessenger>.

Definition at line 16 of file FlutterChannelsTest.m.

38 :(NSString*)channel
39 binaryMessageHandler:
40 (FlutterBinaryMessageHandler _Nullable)handler {
41 [self.handlers setObject:handler forKey:channel];
42 return 0;
43}
void(^ FlutterBinaryMessageHandler)(NSData *_Nullable message, FlutterBinaryReply reply)
NSMutableDictionary< NSString *, FlutterBinaryMessageHandler > * handlers

Property Documentation

◆ channel

- (NSString*) channel
readwritenonatomiccopy

Definition at line 14 of file FlutterChannelsTest.m.

◆ handlers

- (NSMutableDictionary<NSString*, FlutterBinaryMessageHandler>*) handlers
readwritenonatomicstrong

Definition at line 16 of file FlutterChannelsTest.m.

◆ message

- (NSData*) message
readwritenonatomicstrong

Definition at line 15 of file FlutterChannelsTest.m.


The documentation for this class was generated from the following file: