ChatClient class abstract

Entry point for all chat operations.

Provides sub-API accessors for users, rooms, messages, contacts, presence, and attachments. Call connect to start receiving real-time events, and dispose when the client is no longer needed.

Most callers do not implement this interface directly — use NomaChat.client from the top-level facade, which wires the concrete implementation (transport, cache, offline queue) from ChatConfig.

Implementers

Constructors

ChatClient()

Properties

attachments ChatAttachmentsApi
File upload, download, and per-room attachment listing.
no setter
auth ChatAuthApi
Authentication and server health checks.
no setter
connectionState ChatConnectionState
Current connection state.
no setter
contacts ChatContactsApi
Contact list, direct messages, blocking.
no setter
events Stream<ChatEvent>
Stream of real-time events (messages, typing, presence, etc.).
no setter
hashCode int
The hash code for this object.
no setterinherited
members ChatMembersApi
Room membership: invite, remove, ban, role management.
no setter
messages ChatMessagesApi
Send, edit, delete messages; receipts, typing, threads, pins, search.
no setter
onOfflineMessageSent ← void Function(String roomId, String tempId, ChatMessage message)?
Optional callback invoked by clients with an offline queue when a queued send completes after the connection is restored.
no getter
pendingOperationCount int
Number of operations currently sitting in the offline queue, waiting to be sent once the connection allows it.
no setter
presence ChatPresenceApi
Online presence status for the current user and contacts.
no setter
rooms ChatRoomsApi
Room lifecycle: create, list, discover, configure, mute, pin.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stateChanges Stream<ChatConnectionState>
Stream that emits whenever the connection state changes.
no setter
users ChatUsersApi
User search, creation, update, and managed-user operations.
no setter

Methods

cancelOfflineSend(String tempId) int
Drops whatever the offline queue is holding for the optimistic row tempId, returning how many operations went. 0 on clients without an offline queue configured, and on a row that was never queued.
cancelPendingRequests([String reason]) → void
Cancels every in-flight REST request.
connect() Future<void>
Opens the real-time connection (WebSocket/SSE/polling) honoring ChatConfig.realtimeMode.
disconnect() Future<void>
Closes the real-time connection without clearing state.
dispose() Future<void>
Releases all resources. The client must not be used after this call.
enqueueOfflineAttachment({required String roomId, required Uint8List bytes, required String mimeType, ChatFailure? causeFailure, String? fileName, MessageType messageType = MessageType.attachment, String? text, Map<String, dynamic>? metadata, String? tempId, String? clientMessageId}) → void
Queues an attachment upload+send for automatic retry once the connection returns, instead of requiring the caller to re-drive the whole upload manually.
flushPendingOperations() Future<void>
Forces an immediate drain attempt of the offline queue instead of waiting for the next reconnect.
logout() Future<void>
Disconnects and clears all local state (rooms, messages, contacts).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyTokenRotated() Future<void>
Notifies the server (via WebSocket) that the auth token has been rotated.
refresh() Future<void>
Force a refresh of the room list and (in polling/manual modes) pull new messages for any room that changed.
refreshRoom(String roomId) Future<void>
Like refresh but scoped to a single room.
toString() String
A string representation of this object.
inherited

Operators

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