BaseMessage class

Base class for messages.

Implementers
Available Extensions

Constructors

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

Properties

allMetaArrays List<MessageMetaArray>?
All MessageMetaArrays of the message.
read / write
channelType ChannelType
The ChannelType of the channel this message belongs to.
read / write
channelUrl String
The channel URL of the channel this message belongs to.
final
chat ↔ Chat
read / write
createdAt int
The creation time of the message in milliseconds.
final
customType String?
The custom type of the message.
final
data String?
The custom data of the message.
read / write
errorCode int?
The error code of them message if the sendingStatus is SendingStatus.failed.
read / write
extendedMessage Map<String, dynamic>
extendedMessage is used for Sendbird UiKit. Only featured in GroupChannel
read / write
forceUpdateLastMessage bool
final
hashCode int
The hash code for this object.
read-onlyoverride
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.
final
isReplyToChannel bool
Determines whether the current message is a replied message and also a message was replied to the channel.
read / write
isSilent bool
Checks whether the message is silent or not.
final
mentionedUsers List<User>
The mentioned users of the message.
read / write
mentionType MentionType?
The mention type. Refer to MentionType.
final
message String
The message text of the message.
final
messageId int
The ID of the message.
final
messageSurvivalSeconds int?
The message's survival seconds.
final
ogMetaData OGMetaData?
The OGMetaData of the message. (https://ogp.me/) Might be null if
final
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:
read / write
parentMessageId int?
The parent message's ID if this is a reply message.
final
reactions List<Reaction>?
The reactions on the message.
read / write
requestId String?
The request ID of the message.
final
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
scheduledInfo ScheduledInfo?
The scheduled info of the message if this is a scheduled message
read / write
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.
read / write
sendingStatus SendingStatus?
The sending status of the message.
read / write
threadInfo ThreadInfo?
The thread info of the message.
read / write
updatedAt int
The updated time of the message in milliseconds.
final

Methods

applyReactionEvent(ReactionEvent event) bool
Applies ReactionEvent to message.
applyThreadInfoUpdateEvent(ThreadInfoUpdateEvent event) bool
Applies ThreadInfoUpdateEvent to a message.
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.
inherited
set(Chat chat) → void
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

getMessage(MessageRetrievalParams params, {Chat? chat}) Future<BaseMessage>
Retrieves a BaseMessage object with a specified message ID.
getMessageFromJsonWithChat<T extends BaseMessage>(Chat chat, Map<String, dynamic> json, {ChannelType? channelType, String? commandType}) → T
getScheduledMessage(ScheduledMessageRetrievalParams params, {Chat? chat}) Future<BaseMessage>
Retrieves a BaseMessage object with a specified scheduled message ID.