Message class

Model class representing a chat message.

Contains all relevant information for a message, including sender, receiver, content, type, status, and metadata.

Constructors

Message.new({required String messageId, required String senderId, required String receiverId, required String text, String? mediaUrl, required DateTime timestamp, required MessageStatus status, required MessageType type, dynamic isDeleted = false})
Creates a Message instance.
Message.fromMap(Map<String, dynamic> map)
Creates a Message instance from a Firestore document map.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
isDeleted → dynamic
Whether the message is deleted.
final
mediaUrl String?
Optional URL for media attached to the message.
final
messageId String
Unique identifier for the message.
final
receiverId String
ID of the user who receives the message.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
senderId String
ID of the user who sent the message.
final
status MessageStatus
Status of the message (delivered, unread, read).
final
text String
The text content of the message.
final
timestamp DateTime
Timestamp when the message was sent.
final
type MessageType
Type of the message (text, audio, etc.).
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap({bool useCurrentTime = false}) Map<String, dynamic>
Converts the Message instance to a map for Firestore storage.
toString() String
A string representation of this object.
inherited

Operators

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