ConvoKitConversationController class final
Owns one conversation's history, realtime state, sending, and read markers.
The default client calls convokit_flutter; replace client to customize
transport, persistence, analytics, or authorization without changing UI.
- Inheritance
-
- Object
- ChangeNotifier
- ConvoKitConversationController
Constructors
- ConvoKitConversationController({required String conversationId, ConvoKitUiClient? client, int messagePageSize = 30, bool markReadOnLoad = true, bool markReadOnReceive = true, Duration typingTimeout = const Duration(seconds: 3), bool autoLoad = true})
-
Creates a controller for
conversationId.
Properties
- conversationId → String
-
Conversation loaded and observed by this controller.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- markReadOnLoad → bool
-
Whether initial history loading should acknowledge the newest rendered
message as read. In an empty room opened with the connected user's own
"mark unread" marker it clears that marker once instead; see markRead.
final
- markReadOnReceive → bool
-
Whether an incoming message from another participant should be
acknowledged once it is rendered (after hydration for media-only rows).
final
- messagePageSize → int
-
Number of messages requested per page.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → ConvoKitConversationState
-
Current immutable controller snapshot.
no setter
- typingTimeout → Duration
-
Delay after the last edit before typing state is cleared automatically.
final
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
cancelEditing(
) → void - Leaves edit mode without saving. A save already in flight still completes against the server, and its row is merged when it answers.
-
cancelReply(
) → void - Drops the composer's quoted message without sending.
-
clearHighlight(
) → void - Clears ConvoKitConversationState.highlightedMessageId.
-
deleteMessage(
String messageId) → Future< bool> -
Deletes the connected user's own message
messageIdand returns whether the row is gone. -
dispose(
) → void -
Discards any resources used by the object.
override
-
jumpToMessage(
String messageId) → Future< bool> -
Replaces the loaded window with the one containing
messageIdand highlights that row; returns whether the row is now rendered. -
listReactionUsers(
String messageId, String emoji, {String? cursor}) → Future< ReactionUsersPage> -
Lists users for one exact
emoji, checking that the login is still the one that started the request before returning the page. -
loadInitial(
) → Future< void> - Reloads metadata and the newest history page, then observes realtime state.
-
loadNewerMessages(
) → Future< void> - Loads the context page immediately newer than the jumped window.
-
loadOlderMessages(
) → Future< void> - Loads the next older page of history.
-
markRead(
) → Future< void> - Acknowledges the newest rendered message as read at the server.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
reconcile(
) → Future< void> - Reloads the viewed history range and persisted read positions. Page using a value cursor so inserts/deletes cannot shift offsets and skip rows. Simultaneous joins/manual refreshes share one request loop.
-
refresh(
) → Future< void> - Reconciles without clearing loaded history or pending sends.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
returnToLatest(
) → Future< void> - Leaves a jumped window and rejoins the live tail.
-
saveEdit(
String text) → Future< bool> -
Saves
textas the new content of ConvoKitConversationState.editingMessage and returns whether edit mode ended with the row updated. -
sendMessage(
{String? text, List< Map< ? media}) → Future<String, dynamic> >Message?> - Sends text and/or already-uploaded structured media.
-
setVisible(
bool visible) → void - Reports whether the conversation is visible to the user.
-
startEditing(
String messageId) → void -
Enters edit mode for the connected user's own message
messageId. -
startReply(
String messageId) → void -
Quotes the rendered message
messageIdin the composer. -
toggleReaction(
String messageId, String emoji) → Future< bool> -
Toggles the caller's exact
emojion a rendered message. The server remains authoritative and the summary is re-read after either outcome. -
toString(
) → String -
A string representation of this object.
inherited
-
updateTyping(
bool isTyping) → Future< void> -
Broadcasts typing state, with automatic idle clearing for
true.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited