BasicMessageChannel<T> class

A named channel for communicating with platform plugins using asynchronous message passing.

Messages are encoded into binary before being sent, and binary messages received are decoded into Dart values. The MessageCodec used must be compatible with the one used by the platform plugin. This can be achieved by creating a basic message channel counterpart of this channel on the platform side. The Dart type of messages sent and received is T, but only the values supported by the specified MessageCodec can be used. The use of unsupported values should be considered programming errors, and will result in exceptions being thrown. The null message is supported for all codecs.

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



BasicMessageChannel(String name, MessageCodec<T> codec, { BinaryMessenger binaryMessenger: defaultBinaryMessenger })
Creates a BasicMessageChannel with the specified name, codec and binaryMessenger. [...]


binaryMessenger BinaryMessenger
The messenger which sends the bytes for this channel, not null.
codec MessageCodec<T>
The message codec used by this channel, not null.
name String
The logical channel on which communication happens, not null.
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


send(T message) Future<T>
Sends the specified message to the platform plugins on this channel. [...]
setMessageHandler(Future<T> handler(T message)) → void
Sets a callback for receiving messages from the platform plugins on this channel. Messages may be null. [...]
setMockMessageHandler(Future<T> handler(T message)) → void
Sets a mock callback for intercepting messages sent on this channel. Messages may be null. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
Returns a string representation of this object.


operator ==(dynamic other) bool
The equality operator. [...]