FlutterBinaryMessenger

@protocol FlutterBinaryMessenger <NSObject>

A facility for communicating with the Flutter side using asynchronous message passing with binary messages.

Implementated by:

  • Undocumented

    Declaration

    Objective-C

    - (NSObject<FlutterTaskQueue>*)makeBackgroundTaskQueue;
  • Undocumented

    Declaration

    Objective-C

    - (FlutterBinaryMessengerConnection)
        setMessageHandlerOnChannel:(NSString*)channel
              binaryMessageHandler:(FlutterBinaryMessageHandler _Nullable)handler
                         taskQueue:(NSObject<FlutterTaskQueue>* _Nullable)taskQueue;
  • 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

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

    Parameters

    channel

    The channel name.

    handler

    The message handler.

    Return Value

    An identifier that represents the connection that was just created to the channel.

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

    Declaration

    Objective-C

    - (void)cleanUpConnection:(FlutterBinaryMessengerConnection)connection;

    Parameters

    connection

    The result from setMessageHandlerOnChannel:binaryMessageHandler:.