BaseMessage class

Base class for messages.

Available Extensions


BaseMessage({required String channelUrl, required ChannelType channelType, required String message, required SendingStatus? sendingStatus, String? data, String? customType, MentionType mentionType = MentionType.users, List<User> mentionedUsers = const <User>[], List<MessageMetaArray>? allMetaArrays, Map<String, dynamic>? extendedMessage, int createdAt = 0, int updatedAt = 0, Sender? sender, int messageId = 0, String? requestId, bool isReplyToChannel = false, int? parentMessageId, Map<String, dynamic>? parentMessage, ThreadInfo? threadInfo, int? messageSurvivalSeconds, bool forceUpdateLastMessage = false, bool isSilent = false, int? errorCode, bool isOperatorMessage = false, OGMetaData? ogMetaData, List<Reaction>? reactions = const <Reaction>[], ScheduledInfo? scheduledInfo})


allMetaArrays List<MessageMetaArray>?
All MessageMetaArrays of the message.
getter/setter pairinherited
channelType ChannelType
The ChannelType of the channel this message belongs to.
getter/setter pairinherited
channelUrl String
The channel URL of the channel this message belongs to.
getter/setter pairinherited
chat ↔ Chat
getter/setter pairinherited
createdAt int
The creation time of the message in milliseconds.
getter/setter pairinherited
customType String?
The custom type of the message.
getter/setter pairinherited
data String?
The custom data of the message.
getter/setter pairinherited
errorCode int?
The error code of them message if the sendingStatus is SendingStatus.failed.
getter/setter pair
extendedMessage Map<String, dynamic>
extendedMessage is used for Sendbird UiKit. Only featured in GroupChannel
getter/setter pairinherited
forceUpdateLastMessage bool
hashCode int
The hash code for this object.
no setteroverride
isOperatorMessage bool
Whether the message was sent from an operator. This value is true if the sender of this message was an operator at the moment this message was sent. Note that Sender.role returns the role of the sender at the current moment (when the server response was sent). So if the sender's operator status changed after sending a message, the value of the property and the result of Sender.role might differ.
getter/setter pair
isReplyToChannel bool
Determines whether the current message is a replied message and also a message was replied to the channel.
getter/setter pair
isSilent bool
Checks whether the message is silent or not.
getter/setter pair
mentionedUserIds List<String>
getter/setter pairinherited
mentionedUsers List<User>
The mentioned users of the message.
getter/setter pairinherited
mentionType MentionType
The mention type. Refer to MentionType.
getter/setter pairinherited
message String
The message text of the message.
getter/setter pair
messageId int
The ID of the message.
getter/setter pair
messageSurvivalSeconds int?
getter/setter pair
messageType MessageType
no setterinherited
ogMetaData OGMetaData?
The OGMetaData of the message. ( Might be null if Application does not support OG-TAG. (all new applications support OG-TAG by default) The message does not contain a valid url. The server did not fetch the OG-Tag yet.
getter/setter pair
parentMessage BaseMessage?
The parent message of this message. Only NonNull if this message is a reply message. It does not contain all properties of the parent message. Only contains: BaseMessage.message. BaseMessage.sender. (null if the parent message is an AdminMessage). BaseMessage.createdAt. File information if it's a FileMessage. FileMessage.type. FileMessage.url. This is only for accessing parent message's information (READ ONLY) and should not to be used to modify the parent message.
getter/setter pair
parentMessageId int?
The parent message's ID if this is a reply message.
getter/setter pair
reactions List<Reaction>?
The reactions on the message.
getter/setter pair
requestId String?
The request ID of the message.
getter/setter pair
rootId String
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scheduledInfo ScheduledInfo?
The scheduled info of the message if this is a scheduled message
getter/setter pair
sender Sender?
The Sender of the message. If SendbirdChatOptions.useMemberInfoInMessage is set true and this message belongs to a GroupChannel (not a super group channel), the sender information, such as nickname and profile url, is returned as the same with the GroupChannel.members. Otherwise, the sender information will be returned as the value of the message creation time.
getter/setter pair
sendingStatus SendingStatus?
The sending status of the message.
getter/setter pair
threadInfo ThreadInfo?
The thread info of the message.
getter/setter pair
updatedAt int
The updated time of the message in milliseconds.
getter/setter pairinherited


applyReactionEvent(ReactionEvent event) bool
Applies ReactionEvent to message.
applyThreadInfoUpdateEvent(ThreadInfoUpdateEvent event) bool
Applies ThreadInfoUpdateEvent to a message.
getMessageId() → dynamic
getMetaArrays(List<String> keys) List<MessageMetaArray>
Returns MessageMetaArray list which is filtered by given metaArrayKeys.
getThreadedMessagesByTimestamp(int timestamp, ThreadedMessageListParams params) Future<ThreadedMessages>
Retrieves the threaded replies of the current message depending on the timestamp. If the current message doesn’t have replies, the result is an empty list. The result is passed to handler as list.
isResendable() bool
Whether the message is resendable.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
serialize() Uint8List
set(Chat chat) → void
toJson() Map<String, dynamic>
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.

Static Methods

buildFromSerializedData(Uint8List data) BaseMessage?
getMessage(MessageRetrievalParams params, {Chat? chat}) Future<BaseMessage>
Retrieves a BaseMessage object with a specified message ID.
getScheduledMessage(ScheduledMessageRetrievalParams params, {Chat? chat}) Future<BaseMessage>
Retrieves a BaseMessage object with a specified scheduled message ID.