Message class abstract
The content of a Pub/Sub message.
All Pub/Sub messages consist of a body of binary data and has an optional set of attributes (key-value pairs) associated with it.
A Message
contains the message body a list of bytes. The message body can
be read and written as a String, in which case the string is converted to
or from UTF-8 automatically.
Constructors
-
Message.withBytes(List<
int> message, {Map<String, String> attributes}) -
Creates a new message with a binary body.
factory
-
Message.withString(String message, {Map<
String, String> attributes}) -
Creates a new message with a String for the body. The String will
be UTF-8 encoded to create the actual binary body for the message.
factory
Properties
-
asBytes
→ List<
int> -
The message body as bytes.
no setter
- asString → String
-
The message body as a String.
no setter
-
attributes
→ Map<
String, String> -
The attributes for this message.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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