PluginAwareMessageCodec class
The codec of the protocol plus one per plugin, picked by message type.
A message in the plugin range (from MessageTypeValue.firstPluginValue)
belongs to a plugin; anything below it belongs to the protocol. encode
routes on that, so a plugin's codec is the one that writes its own
messages. decode has bytes rather than a message, so it asks each codec
in turn and takes the first that reads them — a codec answers null for a
frame that is not its own.
Either way null means no codec here handles that message, which is what
a peer running a plugin this build does not have looks like.
- Implemented types
Constructors
-
PluginAwareMessageCodec({required MessageCodec<
Message> defaultCodec, List<MessageCodec< pluginCodecs = const []})Message> > -
The codec of the protocol plus one per plugin, picked by message type.
const
-
PluginAwareMessageCodec.fromPlugins({required MessageCodec<
Message> defaultCodec, required List<SyncPlugin> plugins}) -
The codec of the protocol plus one per plugin, picked by message type.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
decode(
List< int> data) → Message? -
Decode a message from the transport format
override
-
encode(
Message message) → List< int> ? -
Encode a message into a format suitable for transport
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited