Flutter Engine
FlutterEventChannel Class Reference

#import <FlutterChannels.h>

Inheritance diagram for FlutterEventChannel:

Instance Methods

(instancetype) - initWithName:binaryMessenger:codec:
 
(void) - setStreamHandler:
 

Class Methods

(instancetype) + eventChannelWithName:binaryMessenger:
 
(instancetype) + eventChannelWithName:binaryMessenger:codec:
 

Detailed Description

A channel for communicating with the Flutter side using event streams.

Definition at line 320 of file FlutterChannels.h.

Method Documentation

◆ eventChannelWithName:binaryMessenger:()

+ (instancetype) eventChannelWithName: (NSString*)  name
binaryMessenger: (NSObject<FlutterBinaryMessenger>*)  messenger 

Creates a FlutterEventChannel 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 FlutterViewController.

The channel uses FlutterStandardMethodCodec to decode stream setup and teardown requests, and to encode event envelopes.

Parameters
nameThe channel name.
messengerThe binary messenger.

Definition at line 271 of file FlutterChannels.mm.

References eventChannelWithName:binaryMessenger:codec:.

271  :(NSString*)name
272  binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger {
273  NSObject<FlutterMethodCodec>* codec = [FlutterStandardMethodCodec sharedInstance];
274  return [FlutterEventChannel eventChannelWithName:name binaryMessenger:messenger codec:codec];
275 }
instancetype eventChannelWithName:binaryMessenger:codec:(NSString *name, [binaryMessenger] NSObject< FlutterBinaryMessenger > *messenger, [codec] NSObject< FlutterMethodCodec > *codec)
const char * name
Definition: fuchsia.cc:50

◆ eventChannelWithName:binaryMessenger:codec:()

+ (instancetype) eventChannelWithName: (NSString*)  name
binaryMessenger: (NSObject<FlutterBinaryMessenger>*)  messenger
codec: (NSObject<FlutterMethodCodec>*)  codec 

Creates a FlutterEventChannel with the specified name, binary messenger, and method 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 FlutterViewController.

Parameters
nameThe channel name.
messengerThe binary messenger.
codecThe method codec.

Definition at line 277 of file FlutterChannels.mm.

Referenced by eventChannelWithName:binaryMessenger:.

277  :(NSString*)name
278  binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger
279  codec:(NSObject<FlutterMethodCodec>*)codec {
280  return [[[FlutterEventChannel alloc] initWithName:name binaryMessenger:messenger
281  codec:codec] autorelease];
282 }
const char * name
Definition: fuchsia.cc:50

◆ initWithName:binaryMessenger:codec:()

- (instancetype) initWithName: (NSString*)  name
binaryMessenger: (NSObject<FlutterBinaryMessenger>*)  messenger
codec: (NSObject<FlutterMethodCodec>*)  codec 

Initializes a FlutterEventChannel with the specified name, binary messenger, and method 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.

Parameters
nameThe channel name.
messengerThe binary messenger.
codecThe method codec.

Definition at line 284 of file FlutterChannels.mm.

References _codec, _name, FlutterError::code, FlutterError::details, error, event, FlutterBinaryReply, FlutterEndOfEventStream, FlutterError::message, FlutterMethodCall::method, and name.

284  :(NSString*)name
285  binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger
286  codec:(NSObject<FlutterMethodCodec>*)codec {
287  self = [super init];
288  NSAssert(self, @"Super init cannot be nil");
289  _name = [name retain];
290  _messenger = [messenger retain];
291  _codec = [codec retain];
292  return self;
293 }
NSString * _name
const char * name
Definition: fuchsia.cc:50
NSObject< FlutterMessageCodec > * _codec

◆ setStreamHandler:()

- (void) setStreamHandler: (NSObject< FlutterStreamHandler > *_Nullable)  handler

Registers a handler for stream setup requests from the Flutter side.

Replaces any existing handler. Use a nil handler for unregistering the existing handler.

Parameters
handlerThe stream handler.

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