Message class

Message class to represent a message in the conversation.

Constructors

Message({required Role role, required String content, dynamic images})
Constructor for Message class.

Properties

content ↔ String
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
images ↔ dynamic
getter/setter pair
role ↔ Role
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
timestamp ↔ DateTime
getter/setter pair

Methods

call() → Map<String, dynamic>
Converts the message to a format suitable for the API call. @return A Map of String, dynamic(text or image base64encoded) representing the message.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → String
toString() → String
A string representation of this object.
override

Operators

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

Static Methods

encodeImageToDataUrl(String filePath) → Future<String>
Encodes an image file to a Base64 data URL. @param filePath The path to the image file. @return A Future that resolves to a Base64 data URL string.
image(String file) → Message
Static method to create a message with an image.