Message class

A class representing a message in a conversation, either from the user or the assistant.

Constructors

Message({required String id, required MessageRole role, required String content, required DateTime createdAt})

Properties

content String
The text content of the message.
final
createdAt DateTime
The timestamp when the message was created.
final
hashCode int
The hash code for this object.
no setteroverride
id String
A unique identifier for the message.
final
isAssistant bool
Returns true if the message was sent by the assistant.
no setter
isUser bool
Returns true if the message was sent by the user.
no setter
role MessageRole
The role of the message sender, either MessageRole.user or MessageRole.assistant.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Operators

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