Message class

The class that contains the information about a message.

Available extensions
Annotations
  • @JsonSerializable()

Constructors

Message({String? id, String? text, String type = 'regular', List<Attachment> attachments = const [], List<User> mentionedUsers = const [], bool silent = false, bool shadowed = false, Map<String, int>? reactionCounts, Map<String, int>? reactionScores, 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, DateTime? messageTextUpdatedAt, User? user, bool pinned = false, DateTime? pinnedAt, DateTime? pinExpires, User? pinnedBy, Map<String, Object?> extraData = const {}, MessageState state = const MessageState.initial(), Map<String, String>? i18n})
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
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
extraData Map<String, Object?>
Message custom extraData.
final
hashCode int
The hash code for this object.
no setterinherited
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
isDeleted bool
True if the message has been deleted.
no setter
isEphemeral bool
True if the message is ephemeral.
no setter
isError bool
True if the message is a error.
no setter
isSystem bool
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
mentionedUsers List<User>
The list of user mentioned in the message.
final
messageTextUpdatedAt DateTime?
Reserved field indicating when the message text was edited.
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
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
reactionCounts Map<String, int>?
A map describing the count of number of every reaction.
final
reactionScores Map<String, int>?
A map describing the count of score of every reaction.
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
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shadowed bool
If true the message is shadowed.
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, the toString method will be overridden to output this instance's props.
no setterinherited
text String?
The text of this message.
final
threadParticipants List<User>?
Reserved field indicating the thread participants for this message.
final
type String
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

copyWith({String? id, String? text, String? type, List<Attachment>? attachments, List<User>? mentionedUsers, bool? silent, bool? shadowed, Map<String, int>? reactionCounts, Map<String, int>? reactionScores, 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, Map<String, Object?>? extraData, MessageState? state, Map<String, String>? i18n}) Message
Creates a copy of Message with specified attributes overridden.
merge(Message other) Message
Returns a new Message that is a combination of this message and the given other message.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
syncWith(Message? other) Message
Returns a new Message that is other with local changes applied to it.
toJson() Map<String, dynamic>
Serialize to json.
toString() String
A string representation of this object.
inherited

Operators

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

Constants

topLevelFields → const List<String>
Known top level fields.