Message class

A chat message.

Available extensions

Constructors

Message({required String id, required String conversationId, required String senderId, required MessageContent content, required DateTime clientTimestamp, String? serverId, String? senderName, String? senderAvatar, String? anonymousName, String? anonymousAvatar, MessageType type = MessageType.text, MessageStatus status = MessageStatus.pending, DateTime? serverTimestamp, String? replyToId, Message? replyTo, List<FileAttachment> attachments = const [], List<Reaction> reactions = const [], List<String> readBy = const [], bool isDeleted = false, bool isEdited = false, bool isStarred = false, bool isPinned = false, DateTime? pinnedUntil, int localSequence = 0, Map<String, dynamic>? metadata})
Creates a message.
const

Properties

age Duration

Available on Message, provided by the MessageExtensions extension

Time since message was sent.
no setter
anonymousAvatar String?
final
anonymousName String?
final
attachments List<FileAttachment>
File attachments.
final
canDelete bool

Available on Message, provided by the MessageExtensions extension

Whether this message can be deleted.
no setter
canEdit bool

Available on Message, provided by the MessageExtensions extension

Whether this message can be edited.
no setter
canReply bool

Available on Message, provided by the MessageExtensions extension

Whether this message can be replied to.
no setter
clientTimestamp DateTime
Client-side creation timestamp.
final
content MessageContent
Message content.
final
conversationId String
Conversation this message belongs to.
final
displayText String
Display text for the message.
no setter
hasAttachments bool

Available on Message, provided by the MessageExtensions extension

Whether this message has attachments.
no setter
hasAttachments bool
Whether message has attachments.
no setter
hashCode int
The hash code for this object.
no setterinherited
hasReactions bool

Available on Message, provided by the MessageExtensions extension

Whether this message has reactions.
no setter
hasReactions bool
Whether message has reactions.
no setter
id String
Client-generated unique ID (UUID).
final
isDeleted bool
Whether message is deleted.
final
isEdited bool
Whether message was edited.
final
isFailed bool
Whether message failed to send.
no setter
isPending bool
Whether message is still pending.
no setter
isPinned bool
Whether message is pinned.
final
isReply bool
Whether this is a reply.
no setter
isSent bool
Whether message was sent successfully.
no setter
isStarred bool
Whether message is starred.
final
localSequence int
Local sequence number for ordering.
final
metadata Map<String, dynamic>?
Extended metadata (waveform, dimensions, custom data).
final
pinnedUntil DateTime?
When pin expires.
final
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
reactions List<Reaction>
Emoji reactions.
final
readBy List<String>
User IDs who have read this message.
final
replyTo Message?
Cached reply message (for display).
final
replyToId String?
ID of message being replied to.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
senderAvatar String?
final
senderId String
final
senderName String?
final
serverId String?
Server-assigned ID (null until synced).
final
serverTimestamp DateTime?
Server-side timestamp (when received by server).
final
status MessageStatus
Delivery status.
final
statusEmoji String

Available on Message, provided by the MessageExtensions extension

Status emoji: "⏳", "✓", "✓✓", "✗"
no setter
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
timeLabel String

Available on Message, provided by the MessageExtensions extension

Human-readable time label: "2m ago", "Yesterday", "Jan 15"
no setter
timestamp DateTime
Effective timestamp for display.
no setter
type MessageType
Type of message.
final

Methods

copyWith({String? id, String? serverId, String? conversationId, String? senderId, String? senderName, String? senderAvatar, String? anonymousName, String? anonymousAvatar, MessageContent? content, MessageType? type, MessageStatus? status, DateTime? clientTimestamp, DateTime? serverTimestamp, String? replyToId, Message? replyTo, List<FileAttachment>? attachments, List<Reaction>? reactions, List<String>? readBy, bool? isDeleted, bool? isEdited, bool? isStarred, bool? isPinned, DateTime? pinnedUntil, int? localSequence, Map<String, dynamic>? metadata}) Message
Creates a copy with updated fields.
isFromMe(String myUserId) bool

Available on Message, provided by the MessageExtensions extension

Whether this message was sent by the current user.
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