A named channel for sending events to the framework-side using streams.
This is the platform-side equivalent of EventChannel. Whereas EventChannel receives a stream of events from platform plugins, this channel sends a stream of events to the handler listening on the framework-side.
The channel name must not be null. If no codec is provided, then StandardMethodCodec is used. If no binaryMessenger is provided, then pluginBinaryMessenger, which sends messages to the framework-side, is used.
Channels created using this class implement two methods for subscribing to the event stream. The methods use the encoding of the specified codec.
The first method is
listen. When called, it begins forwarding
messages to the framework side when they are added to the
controller. This triggers the StreamController.onListen callback
The other method is
cancel. When called, it stops forwarding
events to the framework. This triggers the StreamController.onCancel
callback on the
Events added to the
controller when the framework is not
subscribed are silently discarded.
- PluginEventChannel(String name, [MethodCodec codec = const StandardMethodCodec(), BinaryMessenger? binaryMessenger])
Creates a new plugin event channel.
- binaryMessenger → BinaryMessenger?
The messenger used by this channel to send platform messages.
- codec → MethodCodec
The message codec used by this channel.
Use setController instead.
- hashCode → int
The hash code for this object.
- name → String
The logical channel on which communication happens.
- runtimeType → Type
A representation of the runtime type of the object.
Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
StreamController< T>? controller) → void
- Changes the stream controller for this event channel.
) → String
A string representation of this object.
Object other) → bool
The equality operator.