Conversation class

Represents a conversation with an AI provider.

Constructors

Conversation({String? id, List<AIMessage>? messages, int totalTokensUsed = 0, DateTime? createdAt, DateTime? updatedAt, String? title, Map<String, dynamic>? metadata})
Conversation.fromJson(Map<String, dynamic> json)
factory

Properties

activeMessages List<AIMessage>
Returns messages suitable for sending to an AI provider.
no setter
createdAt DateTime
When the conversation was created.
final
hashCode int
The hash code for this object.
no setterinherited
id String
Unique identifier for this conversation.
final
isEmpty bool
Whether the conversation is empty (no user/assistant messages).
no setter
messageCount int
Number of messages in the conversation.
no setter
messages List<AIMessage>
Read-only view of the messages in this conversation.
no setter
metadata Map<String, dynamic>
Optional metadata.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
systemMessage AIMessage?
Returns the system prompt if one exists.
no setter
title String?
Optional title for the conversation.
getter/setter pair
totalTokensUsed int
Total tokens used in this conversation.
getter/setter pair
updatedAt DateTime
When the conversation was last updated.
getter/setter pair

Methods

addMessage(AIMessage message) → void
Adds a message to the conversation.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
override

Operators

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