EventChannel class Null safety

A named channel for communicating with platform plugins using event streams.

Stream setup requests are encoded into binary before being sent, and binary events and errors received are decoded into Dart values. The MethodCodec used must be compatible with the one used by the platform plugin. This can be achieved by creating an EventChannel counterpart of this channel on the platform side. The Dart type of events sent and received is dynamic, but only values supported by the specified MethodCodec can be used.

The logical identity of the channel is given by its name. Identically named channels will interfere with each other's communication.

See: flutter.dev/platform-channels/

Constructors

EventChannel(String name, [MethodCodec codec = const StandardMethodCodec(), BinaryMessenger? binaryMessenger])
Creates an EventChannel with the specified name.
const

Properties

binaryMessenger BinaryMessenger
The messenger used by this channel to send platform messages, not null.
read-only
codec MethodCodec
The message codec used by this channel, not null.
final
hashCode int
The hash code for this object.
read-onlyinherited
name String
The logical channel on which communication happens, not null.
final
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
receiveBroadcastStream([dynamic arguments]) Stream
Sets up a broadcast stream for receiving events on this channel.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited