ChatMessage class

Represents a chat message.

The ChatMessage class stores the details of a message within a chat system, including the text content, the time when the message was sent, and the author who sent the message.

Example:


@override
Widget build(BuildContext context) {
 return SfChat(
   messages: [
     ChatMessage(
       text: 'Hi',
       time: DateTime.now(),
       author: ChatAuthor(id: '123-001', name: 'Chat A'),
     ),
   ],
 );
}

Constructors

ChatMessage({required String text, required DateTime time, required ChatAuthor author})
Creates a ChatMessage instance with the given text, time, and author.
const

Properties

author ChatAuthor
Author of the message.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
text String
Content of the message.
final
time DateTime
Timestamp when the message was sent.
final

Methods

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

Operators

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