Message class
The class that contains the information about a message.
- Available extensions
- Annotations
-
- @JsonSerializable.new()
Constructors
-
Message({String? id, String? text, String type = MessageType.regular, List<
Attachment> attachments = const [], bool? mentionedChannel, List<String> ? mentionedGroupIds, List<UserGroup> ? mentionedGroups, bool? mentionedHere, List<String> ? mentionedRoles, List<User> mentionedUsers = const [], bool silent = false, bool shadowed = false, Map<String, ReactionGroup> ? reactionGroups, List<Reaction> ? latestReactions, List<Reaction> ? ownReactions, String? parentId, Message? quotedMessage, String? quotedMessageId, int? replyCount = 0, List<User> ? threadParticipants, bool? showInChannel, String? command, DateTime? createdAt, DateTime? localCreatedAt, DateTime? updatedAt, DateTime? localUpdatedAt, DateTime? deletedAt, DateTime? localDeletedAt, bool? deletedForMe, DateTime? messageTextUpdatedAt, User? user, bool pinned = false, DateTime? pinnedAt, DateTime? pinExpires, User? pinnedBy, Poll? poll, String? pollId, Map<String, Object?> extraData = const {}, MessageState state = const MessageState.initial(), Map<String, String> ? i18n, List<String> ? restrictedVisibility, Moderation? moderation, Draft? draft, MessageReminder? reminder, String? channelRole, }) - Constructor used for json serialization.
-
Message.fromJson(Map<
String, dynamic> json) -
Create a new instance from JSON.
factory
Properties
-
attachments
→ List<
Attachment> -
The list of attachments, either provided by the user or generated from a
command or as a result of URL scraping.
final
- channelRole → String?
-
The role of the user in the channel the message belongs to.
final
- command → String?
-
A used command name.
final
- createdAt → DateTime
-
Indicates when the message was created.
no setter
- deletedAt → DateTime?
-
Indicates when the message was deleted.
no setter
- deletedForMe → bool?
-
Whether the message was deleted only for the current user.
final
- draft → Draft?
-
Optional draft message linked to this message.
final
-
extraData
→ Map<
String, Object?> -
Message custom extraData.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasRestrictedVisibility → bool
-
Available on Message, provided by the MessageVisibility extension
Checks if this message has any visibility restrictions applied.no setter -
i18n
→ Map<
String, String> ? -
A Map of translations.
final
- id → String
-
The message ID. This is either created by Stream or set client side when
the message is added.
final
- isBounced → bool
-
Available on Message, provided by the MessageModerationHelper extension
True if the message is bounced by the moderation system.no setter - isBouncedWithError → bool
-
Available on Message, provided by the MessageModerationHelper extension
True if the message is bounced with an error by the moderation system.no setter - isDeleted → bool
-
Available on Message, provided by the MessageTypeHelper extension
True if the message has been deleted.no setter - isEphemeral → bool
-
Available on Message, provided by the MessageTypeHelper extension
True if the message is ephemeral.no setter - isError → bool
-
Available on Message, provided by the MessageTypeHelper extension
True if the message is a error.no setter - isFlagged → bool
-
Available on Message, provided by the MessageModerationHelper extension
True if the message is flagged by the moderation system.no setter - isRegular → bool
-
Available on Message, provided by the MessageTypeHelper extension
True if the message is a regular message.no setter - isRemoved → bool
-
Available on Message, provided by the MessageModerationHelper extension
True if the message is removed by the moderation system.no setter - isReply → bool
-
Available on Message, provided by the MessageTypeHelper extension
True if the message is a reply to another message.no setter - isShadowed → bool
-
Available on Message, provided by the MessageModerationHelper extension
True if the message is shadowed by the moderation system.no setter - isSystem → bool
-
Available on Message, provided by the MessageTypeHelper extension
True if the message is a system info.no setter -
latestReactions
→ List<
Reaction> ? -
The latest reactions to the message created by any user.
final
- localCreatedAt → DateTime?
-
Indicates when the message was created locally.
final
- localDeletedAt → DateTime?
-
Indicates when the message was deleted locally.
final
- localUpdatedAt → DateTime?
-
Indicates when the message was updated locally.
final
- mentionedChannel → bool?
-
Boolean indicator if the message contains a "@channel" mention.
final
-
mentionedGroupIds
→ List<
String> ? -
The list of group ids mentioned in the message.
final
-
mentionedGroups
→ List<
UserGroup> ? -
The list of groups mentioned in the message, hydrated by the server from
mentionedGroupIds.
final
- mentionedHere → bool?
-
Boolean indicator if the message contains a "@here" mention.
final
-
mentionedRoles
→ List<
String> ? -
The list of roles mentioned in the message.
final
-
mentionedUsers
→ List<
User> -
The list of user mentioned in the message.
final
- messageTextUpdatedAt → DateTime?
-
Reserved field indicating when the message text was edited.
final
- moderation → Moderation?
-
The moderation details for this message.
final
-
ownReactions
→ List<
Reaction> ? -
The reactions added to the message by the current user.
final
- parentId → String?
-
The ID of the parent message, if the message is a thread reply.
final
- pinExpires → DateTime?
-
Reserved field indicating when the message will expire.
final
- pinned → bool
-
If true the message is pinned.
final
- pinnedAt → DateTime?
-
Reserved field indicating when the message was pinned.
final
- pinnedBy → User?
-
Reserved field indicating who pinned the message.
final
- poll → Poll?
-
The poll associated with this message.
final
- pollId → String?
-
The ID of the poll associated with this message.
no setter
-
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setter
- quotedMessage → Message?
-
A quoted reply message.
final
- quotedMessageId → String?
-
The ID of the quoted message, if the message is a quoted reply.
no setter
-
reactionGroups
→ Map<
String, ReactionGroup> ? -
A map of reaction types and their corresponding reaction groups.
final
- reminder → MessageReminder?
-
Optional reminder for this message.
final
- remoteCreatedAt → DateTime?
-
Indicates when the message was created on the server.
final
- remoteDeletedAt → DateTime?
-
Indicates when the message was deleted on the server.
final
- remoteUpdatedAt → DateTime?
-
Indicates when the message was updated on the server.
final
- replyCount → int?
-
Reserved field indicating the number of replies for this message.
final
-
restrictedVisibility
→ List<
String> ? -
The list of user ids that should be able to see the message.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shadowed → bool
-
If true the message is shadowed.
final
-
Optional shared location associated with this message.
final
- showInChannel → bool?
-
Check if this message needs to show in the channel.
final
- silent → bool
-
If true the message is silent.
final
- state → MessageState
-
The current state of the message.
final
- stringify → bool?
-
If set to
true, thetoStringmethod will be overridden to output this instance'sprops.no setterinherited - text → String?
-
The text of this message.
final
-
threadParticipants
→ List<
User> ? -
Reserved field indicating the thread participants for this message.
final
- type → MessageType
-
The message type.
final
- updatedAt → DateTime
-
Indicates when the message was updated last time.
no setter
- user → User?
-
User who sent the message.
final
Methods
-
addMyReaction(
Reaction reaction, {bool enforceUnique = false}) → Message -
Available on Message, provided by the MessageReactionHelper extension
Adds a new reaction to the message. -
copyWith(
{String? id, String? text, String? type, List< Attachment> ? attachments, bool? mentionedChannel, List<String> ? mentionedGroupIds, List<UserGroup> ? mentionedGroups, bool? mentionedHere, List<String> ? mentionedRoles, List<User> ? mentionedUsers, bool? silent, bool? shadowed, Map<String, ReactionGroup> ? reactionGroups, List<Reaction> ? latestReactions, List<Reaction> ? ownReactions, String? parentId, Object? quotedMessage = _nullConst, Object? quotedMessageId = _nullConst, int? replyCount, List<User> ? threadParticipants, bool? showInChannel, String? command, DateTime? createdAt, DateTime? localCreatedAt, DateTime? updatedAt, DateTime? localUpdatedAt, DateTime? deletedAt, DateTime? localDeletedAt, DateTime? messageTextUpdatedAt, User? user, bool? pinned, DateTime? pinnedAt, Object? pinExpires = _nullConst, User? pinnedBy, Poll? poll, String? pollId, Map<String, Object?> ? extraData, MessageState? state, Map<String, String> ? i18n, List<String> ? restrictedVisibility, Moderation? moderation, Object? draft = _nullConst, Object? reminder = _nullConst, String? channelRole, bool? deletedForMe}) → Message - Creates a copy of Message with specified attributes overridden.
-
deleteMyReaction(
{String? reactionType}) → Message -
Available on Message, provided by the MessageReactionHelper extension
Deletes all the current user's reactions from the message. -
getComparableField(
String sortKey) → ComparableField? -
Gets a comparable field value for the given
sortKey. -
isNotVisibleTo(
String userId) → bool -
Available on Message, provided by the MessageVisibility extension
Determines if a message is not visible to a specific user based on restricted visibility settings. -
isVisibleTo(
String userId) → bool -
Available on Message, provided by the MessageVisibility extension
Determines if a message is visible to a specific user based on restricted visibility settings. -
merge(
Message other) → Message -
Returns a new Message that is a combination of this message and the
given
othermessage. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
replaceMentions(
{bool linkify = true}) → Message - Wraps mention substrings in the message text with markdown so the renderer can style and dispatch taps by mention kind.
-
replaceMentionsWithId(
) → Message - It returns the message replacing the mentioned user names with the respective user ids
-
roughMessageSize(
double? fontSize) → double - Returns an approximation of message size
-
syncWith(
Message? other) → Message -
Returns a new Message that is this message reconciled with the local
changes from
other. -
toDraftMessage(
) → DraftMessage -
Available on Message, provided by the MessageToDraftMessage extension
Converts this DraftMessage to a Message. -
toJson(
) → Map< String, dynamic> - Serialize to json.
-
toMediaGalleryAttachments(
{bool filter(Attachment)?}) → List< StreamMediaGalleryAttachment> -
Available on Message, provided by the MessageMediaGalleryX extension
Returns one StreamMediaGalleryAttachment per Message.attachments entry on this message, each paired with the message itself. -
toString(
) → String -
A string representation of this object.
inherited
-
translate(
String language) → Message - It returns the message with the translated text if available locally
-
updateWith(
Message? other) → Message -
Returns a new Message that is
otherreconciled with this message.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
topLevelFields
→ const List<
String> - Known top level fields.