Chat class

Annotations

Constructors

Chat()

Properties

endedSessionId String?
The ended session id when in read-only mode (for card regeneration).
no setter
hashCode int
The hash code for this object.
no setterinherited
params ChatParams
latefinalinherited
ref NotifierProviderRef<ChatState>
The Ref from the provider associated with this Notifier.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sessionId String?
The active session id, if one has been created.
no setter
sessionStartedAt DateTime?
no setter
state ChatState
The value currently exposed by this Notifier.
getter/setter pairinherited
stateOrNull ChatState?
The value currently exposed by this Notifier.
no setterinherited

Methods

build(ChatParams params) ChatState
dismissPrereqGap(String concept) → void
Dismiss a single prerequisite-gap concept (user clicked the chip's dismiss button or acknowledged the suggestion).
listenSelf(void listener(ChatState? previous, ChatState next), {void onError(Object error, StackTrace stackTrace)?}) → void
Listens to changes on the value exposed by this provider.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
persistSessionUpdate(Map<String, dynamic> updates) Future<void>
Persist a learning_sessions update (e.g. completed_at, reflection_text) through the outbox + Supabase. Uses the current _sessionId — caller must ensure a session exists. The replay path in SyncWorker applies updates in queued order, which is naturally last-write-wins within a single session because every update for the same sessionId is consumed in created_at order.
persistTopicProgressUpdate(String topicId, Map<String, dynamic> updates) Future<void>
Persist a user_topic_progress upsert through OutboxedWrites. updateProgress already uses onConflict: 'user_id, topic_id' so the replay is naturally idempotent. LWW within a single topic is by drain order (created_at ordering in the outbox).
restoreSession() Future<bool>
Restore the most relevant session for this topic+mode.
sendMessage(String userMessage) Future<void>
Send a user message, call Claude, and update state.
setSessionId(String id) → void
Set the session id (e.g. after creating a LearningSession).
startNewSession() → void
Allow the user to continue the conversation in a new session. Keeps existing messages visible; next sendMessage creates a new session.
toString() String
A string representation of this object.
inherited
updateShouldNotify(ChatState previous, ChatState next) bool
A method invoked when the state exposed by this Notifier changes. It compares the previous and new value, and return whether listeners should be notified.
inherited

Operators

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