ChatMessage class sealed
Base type of every item shown in a conversation.
The hierarchy is sealed, so a switch over a ChatMessage is
exhaustive. Use CustomMessage for content chatx does not render out of
the box.
Every message shares the fields below: author, time, delivery status, replies, reactions, thread summary, read receipts, forwarding and expiration.
Properties
-
The user who wrote the message.
final
- createdAt → DateTime
-
When the message was created. Messages are ordered by this value.
final
- deletedAt → DateTime?
-
When the message was deleted for everyone. The bubble shows a
"message deleted" placeholder instead of the content.
final
- expiresAt → DateTime?
-
When the message disappears. The bubble shows the time left and the
controller removes the message when it expires.
final
- forwardedFrom → String?
-
Name of the original author when the message was forwarded. Shows a
"Forwarded" label.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Unique identifier of the message inside its conversation.
final
-
metadata
→ Map<
String, Object?> ? -
Arbitrary data you want to carry with the message. Never read by chatx.
final
-
reactions
→ List<
ChatReaction> -
Emoji reactions, in the order they were first added.
final
-
receipts
→ List<
ChatReadReceipt> -
Who read the message and when. Shown as "Seen by" avatars in group
chats and in the message info sheet.
final
- replyToId → String?
-
ID of the message this one replies to. The bubble shows a quote of it.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scheduledFor → DateTime?
-
When a scheduled message will be sent. The bubble is dimmed and shows
the scheduled time instead of the delivery status.
final
- status → MessageStatus?
-
Delivery state. Usually only set for messages of the current user.
final
- thread → ChatThreadSummary?
-
Summary of the thread started from this message. The bubble shows the
reply count and
ChatView.onThreadTapopens it.final
Methods
-
copyWithMeta(
{MessageStatus? status, String? replyToId, List< ChatReaction> ? reactions, ChatThreadSummary? thread, List<ChatReadReceipt> ? receipts, String? forwardedFrom, DateTime? expiresAt, DateTime? deletedAt, DateTime? scheduledFor, Map<String, Object?> ? metadata, bool clearStatus = false, bool clearThread = false, bool clearExpiresAt = false, bool clearDeletedAt = false, bool clearScheduledFor = false}) → ChatMessage -
Returns a copy with any of the shared fields replaced. Pass
trueto aclear*flag to set that field tonull. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
withReactions(
List< ChatReaction> reactions) → ChatMessage -
Returns a copy of this message with
reactionsreplaced. -
withStatus(
MessageStatus? status) → ChatMessage -
Returns a copy of this message with
statusreplaced.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited