Message<D, M extends MessageTypeMapping<D> , T extends MessageType<D, M> > class
Implementation of a message with specific data and type.
- Implemented types
-
- IMessage<
T>
- IMessage<
Constructors
-
Message({String? uId, required T messageType, required IList<
D> data, required M mapping, DateTime? timestamp, MessageTiming? timing}) -
Creates a new Message with the given parameters.
The
messageTypeparameter specifies the MessageType of the message. Thedataparameter must be a list of data with length equal to the number of channels specified in themessageType. TheuIdparameter is optional and will be generated if not provided. Thetimestampparameter is optional and will be set to the current time if not provided. Thetimingparameter is set by transports on the receive path; messages constructed locally leave it null.
Properties
-
data
→ IList<
D> -
The data associated with the message
final
- description → String
-
Returns a description of the identity.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Returns a unique identifier for the identity.
no setteroverride
- messageType → T
-
The type of the message
final
-
metadata
→ Map<
String, dynamic> -
Returns the metadata associated with this resource.
no setteroverride
- name → String
-
Returns a human-readable name for the identity.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timestamp → DateTime
-
Returns a timestamp for the object.
This is intentionally generic, as it is not always going to be something
specific like a creation time or modification time.
final
- timing → MessageTiming?
-
Transport-observed timing for this message, or null when the transport
could not supply it (or the message has not been over a wire at all).
final
- uId → String
-
Returns a unique identifier that is guaranteed to be globally unique.
final
Methods
-
getMetadata(
String key, {dynamic defaultValue}) → dynamic -
Returns a specific metadata value by key.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setMetadata(
String key, dynamic value) → void -
toMap(
) → Map< String, dynamic> -
Converts the object to a map representation for serialization.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
) → void - Validates the message data against the MessageTypeMapping. Throws an ArgumentError if the data is invalid.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited