BaseMessage class

Represents base class for messages.

Implementers
Available extensions

Constructors

BaseMessage({Map<String, dynamic>? parentMessage, required bool isPinnedMessage, String? requestId, int messageId = 0, required String message, required MessageSendingStatus? sendingStatus, Sender? sender, required String channelUrl, required ChannelType channelType, List<User> mentionedUsers = const <User>[], MentionType? mentionType, List<String>? mentionedUserIds = const <String>[], List<String>? requestedMentionUserIds, int createdAt = 0, int updatedAt = 0, bool replyToChannel = false, int? parentMessageId, String? parentMessageText, ThreadInfo? threadInfo, List<MessageMetaArray>? metaArrays, 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 {}})
default constructor
BaseMessage.fromJson(Map<String, dynamic> json)
Map json object
factory

Properties

channelType ChannelType
Channel type of this message
getter/setter pair
channelUrl String
Channel url of this message.
final
createdAt int
Message creation time in millisecond(UTC)
final
customType String?
Custom message type
final
data String?
data for this message returns null if data is not a string
getter/setter pair
errorCode int?
The error code of this message. This value generated only when message send fails.
getter/setter pair
extendedMessage Map<String, dynamic>
Only featured in GroupChannel Message Template used for Sendbird UI KIT
getter/setter pair
forceUpdateLastMessage bool
True if this message should update last message of its channel
final
hashCode int
The hash code for this object.
no setteroverride
isOperatorMessage bool
True if this message was created by an operator.
final
isPinnedMessage bool
Pinned Message
getter/setter pair
isSilent bool
True if this message won't affect unread message count / mention count
final
mentionedUserIds List<String>?
Mention to specific users. If sends a message with this field, the message will be arrived to mentioned users.
final
mentionedUsers List<User>
The list of users who was mentioned together with this message.
getter/setter pair
mentionType MentionType?
Mention type that this message uses
final
message String
Message text.
final
messageId int
Unique message ID.
final
messageSurvivalSeconds int?
Message disappear in seconds, default is -1 and won't disappear
final
metaArrays List<MessageMetaArray>?
Gets an array of meta arrays sorted by chronological order. current does not support backward compatibility
getter/setter pair
ogMetaData OGMetaData?
Open graph information in this message. Nullable
final
parentMessage BaseMessage?
Retrieve current message's parent information
getter/setter pair
parentMessageId int?
The unique ID of the parent message. If the message object is a parent message or a single message without any reply, the value of this property is 0. If the object is a reply, the value is the unique ID of its parent message.
final
parentMessageText String?
The written text of the message object’s parent message. If the message object is a parent message, the value of this property is null. If the object is a reply to a parent message and the type of the parent message is UserMessage, the value is message. If it is FileMessage, the value is the name of the uploaded file.
final
reactions List<Reaction>?
reactions for this message
getter/setter pair
replyToChannel bool
Option to reply to channel. The default is false
getter/setter pair
requestedMentionUserIds List<String>?
Represents target user ids to mention when success to send this message. This value is valid only when the message is a pending message or failed message. If the message is a succeeded message, see mentionedUserIds
final
requestId String?
Request ID for checking ACK.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scheduledInfo ScheduledInfo?
Scheduled message information
getter/setter pair
sender Sender?
Sender of this message
getter/setter pair
sendingStatus MessageSendingStatus?
Represents the dispatch state of this message. If this message is not dispatched completely to the Sendbird server, the value is pending. If failed to send the message, the value is failed. And if success to send the message, the value is succeeded.
getter/setter pair
threadInfo ThreadInfo?
The thread info that belongs to this message object.
getter/setter pair
updatedAt int
Message update time in millisecond(UTC).
final

Methods

applyReactionEvent(ReactionEvent event) bool
Applies ReactionEvent to this message.
applyThreadInfoUpdateEvent(ThreadInfoUpdateEvent event) bool
Applies ThreadInfoUpdateEvent event to this message.
containsMentionedUser(User? user) bool

Available on BaseMessage, provided by the BaseMessageInternal extension

getMetaArrays(List<String> keys) List<MessageMetaArray>
Retreives list of MessageMetaArray with given keys
getThreadedMessagesByTimestamp(int timestamp, ThreadedMessageListParams params) Future<ThreadedMessageResponse>
Retrieves threaded messages (replies) on this message with timestamp and params.
hasCreatedLaterThan(int time) bool

Available on BaseMessage, provided by the BaseMessageInternal extension

hasUpdatedLaterThan(int time) bool

Available on BaseMessage, provided by the BaseMessageInternal extension

isResendable() bool
Returns true if this message can be resend.
mentioned({User? user, User? byOtherUser}) bool

Available on BaseMessage, provided by the BaseMessageInternal extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

fromJsonToStringData(dynamic json) String?
getMessage(MessageRetrievalParams params) Future<BaseMessage>
Retrieves a BaseMessage with given MessageRetrievalParams.
getScheduledMessage(ScheduledMessageRetrievalParams params, {OnMessageCallback? callback}) Future<BaseMessage>
Retrieve Scheduled Message
msgFromJson<T extends BaseMessage>(Map<String, dynamic> json, {ChannelType? channelType, String? type}) → T?