डेवलपर्स पर वापस

< Flutter UIKit />

UTD Chat Kit

मीडिया, प्रेज़ेंस और push के साथ ड्रॉप-इन 1:1 और ग्रुप चैट।

संस्करण 0.9.1pub.dev पर
iOS 12+Android 21+
chat_kit.dart
import 'package:utd_chat_kit/utd_chat_kit.dart';

final chat = await UTDChat.init(
  UTDChatConfig(
    appId: '<utd-app-id>',
    appKey: '<utd-app-key>', // publishable; no backend needed
    userId: 'user123',
    userName: 'Sara',
    // push: UTDPushConfig(enabled: true), // FCM, on by default
  ),
);

// Drop-in conversations list → 1:1 and group chats
UTDChat.conversations(chat);

1:1 & group

बातचीत

Drop-in

पूरा UI

Local-first

ऑफ़लाइन स्टोर

Push

+ डीप-लिंक

< utd_chat_kit />

मुख्य विशेषताएँ

UTD Stream Engine सिग्नलिंग प्लेन से संचालित एक local-first, ड्रॉप-इन Flutter चैट पैकेज। WhatsApp-स्टाइल 1:1 और ग्रुप बातचीत के साथ आता है, जिसमें एक ऑफ़लाइन Drift स्टोर और ऑप्टिमिस्टिक आउटबॉक्स, रियल-टाइम प्रेज़ेंस और टाइपिंग, मीडिया अटैचमेंट, ग्रुप भूमिकाएँ और डीप-लिंकिंग के साथ बैकग्राउंड push नोटिफ़िकेशन शामिल हैं — न LiveKit की ज़रूरत, न किसी बैकएंड टोकन सर्वर की।

ड्रॉप-इन बातचीत, 1:1 और ग्रुप चैट UI — कोई अतिरिक्त कोड नहीं

ऑप्टिमिस्टिक आउटबॉक्स और स्मार्ट रीसिंक के साथ local-first Drift स्टोर

ग्रुप लाइफ़साइकल: बनाना, इनवाइट करना, हटाना — owner/admin/member भूमिकाओं के साथ

रियल-टाइम प्रेज़ेंस (ऑनलाइन/अंतिम-बार-देखा) और डिबाउंस्ड टाइपिंग इंडिकेटर

मीडिया अटैचमेंट: फ़ोटो, वीडियो और फ़ाइलें इंजन R2 स्टोरेज के ज़रिए

बैकग्राउंड push नोटिफ़िकेशन (FCM) के साथ फ़ोरग्राउंड बैनर और डीप-लिंकिंग

थीम-योग्य डिफ़ॉल्ट UI, कस्टमाइज़ करने योग्य रंगों, फ़ॉन्ट और स्ट्रिंग्स के साथ

बिल्ट-इन i18n (EN/AR), होस्ट द्वारा ओवरराइड की जा सकने वाली स्ट्रिंग्स के साथ

कोई बैकएंड टोकन सर्वर नहीं — appKey-आधारित सेशन मिंटिंग

< utd_chat_kit />

शुरू करें

1

इंस्टॉल करें

Terminal
flutter pub add utd_chat_kit
2

pub.dev पर देखें

मीडिया, प्रेज़ेंस और push के साथ ड्रॉप-इन 1:1 और ग्रुप चैट।

< utd_chat_kit />

API संदर्भ

Main entry & screens

The UTDChat static facade for creating a connected chat session and building the kit's default screens (conversations list, 1:1/group chat, create-group, group-info), each pre-wrapped in a UTDChatScope.

UTDChatclass
abstract final class UTDChat

Top-level entry to the chat kit, declared as an abstract final class exposing only static members. UTDChat.init mints, connects and starts sync from a UTDChatConfig and returns a live UTDChatClient the host owns (and must dispose). UTDChat.scope wraps any subtree so the built-in screens can read the client/theme/strings, and the screen-builder helpers build the kit's default screens already wrapped in that scope. Has no public constructor (cannot be instantiated).

initmethodasync
static Future<UTDChatClient> init(UTDChatConfig config)

Creates the session: constructs a UTDChatClient from the config, mints the per-user bearer and signal token, connects the signalling WebSocket and starts the local-first sync engine. The host owns the returned client and is responsible for calling UTDChatClient.dispose.

पैरामीटर

  • configUTDChatConfigआवश्यक

    The chat kit configuration (credentials, user id, base URLs, theme, strings, push options) used to build and connect the client.

रिटर्न मान: Future<UTDChatClient>A connected, sync-started chat session the caller owns and must dispose.

scopemethod
static Widget scope({required UTDChatClient client, required Widget child})

Wraps child in a UTDChatScope so the default widgets can resolve the session, theme and strings from BuildContext. The theme and strings are taken from client.config. Used internally by all the screen-builder helpers and exposed for custom screens that need access to the scope.

पैरामीटर

  • clientUTDChatClientआवश्यक

    The live chat session to expose to descendants via the inherited scope.

  • childWidgetआवश्यक

    The subtree that will be able to read the client, theme and strings from context.

रिटर्न मान: WidgetA UTDChatScope wrapping child with the client and its configured theme/strings.

conversationsmethod
static Widget conversations(UTDChatClient client)

Builds the conversation-list screen (UTDConversationsListScreen) already wrapped in its scope. Drop the returned widget into a route as the chat home screen.

पैरामीटर

  • clientUTDChatClientआवश्यक

    The connected chat session backing the conversation list.

रिटर्न मान: WidgetThe scoped conversations-list screen.

chatmethod
static Widget chat(UTDChatClient client, {required String conversationId, required String peerIdentity, String? title})

Builds a single 1:1 chat thread screen (UTDChatScreen) wrapped in its scope for the given conversation and peer.

पैरामीटर

  • clientUTDChatClientआवश्यक

    The connected chat session backing the thread.

  • conversationIdStringआवश्यक

    The id of the conversation to open.

  • peerIdentityStringआवश्यक

    The identity of the other participant in the 1:1 conversation (drives presence and the header).

  • titleString?डिफ़ॉल्ट = null

    Optional display title for the chat header; falls back to a derived/default title when null.

रिटर्न मान: WidgetThe scoped 1:1 chat screen.

groupmethod
static Widget group(UTDChatClient client, {required String conversationId, String? title})

Builds a group chat screen (UTDChatScreen with isGroup: true) wrapped in its scope. Peers' bubbles carry sender names and the header opens the group-info screen.

पैरामीटर

  • clientUTDChatClientआवश्यक

    The connected chat session backing the group thread.

  • conversationIdStringआवश्यक

    The id of the group conversation to open.

  • titleString?डिफ़ॉल्ट = null

    Optional group title shown in the header; falls back to a derived/default title when null.

रिटर्न मान: WidgetThe scoped group chat screen.

createGroupmethod
static Widget createGroup(UTDChatClient client, {List<String> initialMembers = const []})

Builds the create-group screen (UTDCreateGroupScreen) wrapped in its scope, optionally pre-selecting initial members.

पैरामीटर

  • clientUTDChatClientआवश्यक

    The connected chat session used to create the group.

  • initialMembersList<String>डिफ़ॉल्ट = const []

    Member identities to pre-select on the create-group screen.

रिटर्न मान: WidgetThe scoped create-group screen.

groupInfomethod
static Widget groupInfo(UTDChatClient client, {required String conversationId, String? title})

Builds the group-info screen (UTDGroupInfoScreen) — member list plus management — wrapped in its scope.

पैरामीटर

  • clientUTDChatClientआवश्यक

    The connected chat session backing the group.

  • conversationIdStringआवश्यक

    The id of the group conversation whose info is shown.

  • titleString?डिफ़ॉल्ट = null

    Optional title shown in the group-info header.

रिटर्न मान: WidgetThe scoped group-info screen.

UTDChatScopewidget
const UTDChatScope({Key? key, required UTDChatClient client, required UTDChatTheme theme, required UTDChatStrings strings, required Widget child})

InheritedWidget that carries the chat session's client, theme and strings down to the kit's built-in default widgets via the element tree. Routes pushed from the kit (e.g. the chat thread) re-wrap their subtree in a fresh UTDChatScope captured from the originating context so new routes can still read the session. Produced by UTDChat.scope and the screen-builder helpers; descendants read it with UTDChatScope.of / maybeOf.

पैरामीटर

  • keyKey?डिफ़ॉल्ट = null

    Standard widget key.

  • clientUTDChatClientआवश्यक

    The live chat session exposed to descendants.

  • themeUTDChatThemeआवश्यक

    Visual theme for the default UI.

  • stringsUTDChatStringsआवश्यक

    UI strings for the default UI.

  • childWidgetआवश्यक

    The wrapped subtree.

clientfield
final UTDChatClient client

The live chat session carried by this UTDChatScope.

रिटर्न मान: UTDChatClientThe chat session.

themefield
final UTDChatTheme theme

The visual theme for the default UI carried by this scope.

रिटर्न मान: UTDChatThemeThe theme.

stringsfield
final UTDChatStrings strings

The UI strings carried by this scope.

रिटर्न मान: UTDChatStringsThe strings.

UTDChatScope.ofmethod
static UTDChatScope of(BuildContext context)

Resolves the nearest UTDChatScope from context, asserting that one exists. Used by the kit's default widgets to read the session/theme/strings.

पैरामीटर

  • contextBuildContextआवश्यक

    The build context to look up from.

रिटर्न मान: UTDChatScopeThe nearest enclosing scope (asserts non-null in debug).

UTDChatScope.maybeOfmethod
static UTDChatScope? maybeOf(BuildContext context)

Resolves the nearest UTDChatScope from context via dependOnInheritedWidgetOfExactType, returning null when none is present.

पैरामीटर

  • contextBuildContextआवश्यक

    The build context to look up from.

रिटर्न मान: UTDChatScope?The nearest enclosing scope, or null if there is none.

updateShouldNotifymethod
bool updateShouldNotify(UTDChatScope oldWidget)

Notifies dependents when the client, theme or strings reference changes between the old and new scope.

पैरामीटर

  • oldWidgetUTDChatScopeआवश्यक

    The previous scope instance to compare against.

रिटर्न मान: boolTrue if client, theme or strings differs from oldWidget.

Session & client

The UTDChatClient session facade owns the REST client, signalling WebSocket, local Drift store and sync engine, exposing connect/dispose lifecycle, store/conversation/message access, connection state and push deep-link routing.

UTDChatClientclass
UTDChatClient({required UTDChatConfig config, ChatDatabase? database})

The chat kit's session facade. Owns the REST client, the signalling WebSocket, the local Drift store and the sync engine, wiring them together: mint the per-user bearer, mint signal credentials, connect the WebSocket and start the sync engine. Controllers and UI read everything through database/sync/outbox and never touch the transport directly.

पैरामीटर

  • configUTDChatConfigआवश्यक

    The kit configuration: app credentials, the caller's identity/name, optional base URLs, device id, push and theme/strings. Drives authentication and which engine the client talks to.

  • databaseChatDatabase?डिफ़ॉल्ट = ChatDatabase()

    Optional local Drift store override; defaults to a fresh ChatDatabase instance. Useful for tests or sharing a store.

configfield
final UTDChatConfig config

The immutable kit configuration this client was constructed with (credentials, identity, base URLs, push, theme/strings).

databasegetter
ChatDatabase get database

The local Drift store that is the source of truth; controllers watch this for conversations and messages.

रिटर्न मान: ChatDatabaseThe local-first store backing all reads.

syncgetter
SyncEngine get sync

The sync coordinator that handles history pull (REST), live pushes (signalling WebSocket) and reconnect, draining everything into the local store.

रिटर्न मान: SyncEngineThe sync engine instance.

outboxgetter
Outbox get outbox

The optimistic-send pipeline that queues and sends outgoing messages, surviving offline resends.

रिटर्न मान: OutboxThe optimistic outbox instance.

signalgetter
UTDSignalClient get signal

The realtime signalling client, exposing connection state and force-exit handling.

रिटर्न मान: UTDSignalClientThe underlying signalling WebSocket client.

connectionStategetter
ValueListenable<UTDConnectionState> get connectionState

The live signalling connection state as a ValueListenable, so UI can react to connect/reconnect/force-exit transitions.

रिटर्न मान: ValueListenable<UTDConnectionState>Listenable connection lifecycle state.

apigetter
UTDApi get api

The high-level engine REST API wrapper used for session minting and privileged calls.

रिटर्न मान: UTDApiThe REST API facade.

notificationRoutergetter
UTDNotificationRouter get notificationRouter

The push deep-link router (process-wide singleton). Register a navigation handler via its setHandler so a notification tap opens the chat screen; deep-links are queued until the client is connected.

रिटर्न मान: UTDNotificationRouterThe shared notification router instance.

connectmethodasync
Future<void> connect()

Connect the signalling WebSocket (which mints + applies the per-user bearer) and start the sync engine. Idempotent. Marks the notification router ready so queued push deep-links flow, then best-effort registers this device's push token when config.push.enabled. Throws on a hard auth/connect failure.

रिटर्न मान: Future<void>Completes once connected and sync has started.

disposemethodasync
Future<void> dispose()

Tear down the session: mark the notification router not-ready, stop push, dispose the sync engine, disconnect the signalling socket, close the REST client and close the local database.

रिटर्न मान: Future<void>Completes once all resources are released.

UTDNotificationRouterclass
UTDNotificationRouter.instance

Routes push deep-links to the host's navigation, guarded behind chat-client readiness. A process-wide singleton accessed via UTDNotificationRouter.instance. A deep-link is delivered only once BOTH a handler is set AND the router is ready; otherwise the latest deep-link is queued (most-recent wins). Use no public constructor; obtain via instance.

instanceproperty
static final UTDNotificationRouter instance

The process-wide singleton notification router instance.

isReadygetter
bool get isReady

Whether the chat client is connected/authenticated and able to open a conversation.

रिटर्न मान: boolTrue when ready to navigate to a conversation.

setHandlermethod
void setHandler(UTDChatDeepLinkHandler? handler)

Register the host's navigation callback that opens the chat screen for a deep-link. Flushes any pending deep-link if the router is already ready. Pass null to clear.

पैरामीटर

  • handlerUTDChatDeepLinkHandler?आवश्यक

    Host callback invoked with the deep-link target, or null to unregister.

markReadymethod
void markReady()

Mark the chat client ready (connected) and flush any queued deep-link. Called internally by UTDChatClient.connect.

markNotReadymethod
void markNotReady()

Mark the chat client not ready (e.g. on dispose/logout); subsequent deep-links queue until the next markReady. Called internally by UTDChatClient.dispose.

dispatchmethod
void dispatch(UTDChatDeepLink link)

Route a deep-link: deliver it immediately if ready and a handler is set, otherwise queue it (overwriting any previously queued link).

पैरामीटर

  • linkUTDChatDeepLinkआवश्यक

    The deep-link target to route.

fromDataOrNullmethod
static UTDChatDeepLink? fromDataOrNull(Map<String, dynamic> data)

Parse a chat deep-link from an FCM data map, or return null if it is not a {type:'message', conversation_id, ...} payload.

पैरामीटर

  • dataMap<String, dynamic>आवश्यक

    The FCM data payload to parse.

रिटर्न मान: UTDChatDeepLink?The parsed deep-link, or null when the payload is not a chat message.

UTDChatDeepLinkclass
const UTDChatDeepLink({required String conversationId, String? messageId, String? senderIdentity, String? senderName})

An immutable deep-link target parsed from a {type:'message', ...} push payload, identifying the conversation (and optionally the message/sender) to open.

पैरामीटर

  • conversationIdStringआवश्यक

    The conversation to open.

  • messageIdString?

    The message that triggered the push, when present.

  • senderIdentityString?

    The sender's identity, when present.

  • senderNameString?

    The sender's display name, when present.

UTDChatDeepLink.fromDatamethod
static UTDChatDeepLink? fromData(Map<String, dynamic> data)

Parse a deep-link from an FCM data map. Returns null if it is not a chat message payload or carries no conversation_id.

पैरामीटर

  • dataMap<String, dynamic>आवश्यक

    The FCM data payload to parse.

रिटर्न मान: UTDChatDeepLink?The parsed deep-link, or null when not a chat message payload.

UTDChatDeepLinkHandlertypedef
typedef UTDChatDeepLinkHandler = void Function(UTDChatDeepLink link)

A host-supplied callback that navigates to the chat screen for a deep-link.

UTDConnectionStateenum
enum UTDConnectionState { disconnected, connecting, connected, reconnecting, forceExit }

Signalling connection lifecycle exposed by connectionState. Values: disconnected (initial / after normal leave), connecting (attempt in flight), connected (live), reconnecting (dropped, auto-reconnecting), forceExit (server removed the session or reconnection failed — the host should leave/re-authenticate).

Configuration

Configuration objects that authenticate, brand, localize, and tune the chat kit: UTDChatConfig plus its theme, strings, and background-push option types.

UTDChatConfigclass
const UTDChatConfig({required String appId, required String appKey, required String userId, required String userName, String? baseUrl, String? tokenBaseUrl, String? deviceId, UTDPushConfig push = const UTDPushConfig(), UTDChatTheme theme = const UTDChatTheme(), UTDChatStrings? strings})

Everything the chat kit needs to authenticate and render: publishable credentials (appId/appKey), the caller identity (userId/userName), optional engine/mint base URLs and device id override, and the push/theme/strings customization hooks. Immutable and Equatable.

पैरामीटर

  • appIdStringआवश्यक

    Publishable project id, sent as the `X-App-Id` header.

  • appKeyStringआवश्यक

    Publishable project key (`X-App-Key`), sent only to the mint host.

  • userIdStringआवश्यक

    The caller's stable identity (the engine `identity`).

  • userNameStringआवश्यक

    The caller's display name.

  • baseUrlString?

    Engine host for privileged REST (Bearer). Defaults to the kit's built-in origin when null.

  • tokenBaseUrlString?

    Mint host for `X-App-Key` token minting. Defaults to the kit's built-in origin when null.

  • deviceIdString?

    Explicit device id override; defaults to the persisted per-install id.

  • pushUTDPushConfigडिफ़ॉल्ट = const UTDPushConfig()

    Background message push (FCM) configuration. Push is on by default; the engine still gates delivery until its FCM/APNs env is provisioned.

  • themeUTDChatThemeडिफ़ॉल्ट = const UTDChatTheme()

    Visual theme for the default UI.

  • stringsUTDChatStrings?

    Custom UI strings; falls back to the English defaults when null.

appIdfield
final String appId

Publishable project id (`X-App-Id`).

appKeyfield
final String appKey

Publishable project key (`X-App-Key`), sent only to the mint host.

userIdfield
final String userId

The caller's stable identity (engine `identity`).

userNamefield
final String userName

The caller's display name.

baseUrlfield
final String? baseUrl

Engine host for privileged REST (Bearer); null means the kit's built-in origin.

tokenBaseUrlfield
final String? tokenBaseUrl

Mint host (`X-App-Key`); null means the kit's built-in origin.

deviceIdfield
final String? deviceId

Explicit device id override; null falls back to the persisted per-install id.

pushfield
final UTDPushConfig push

Background message push (FCM) configuration.

themefield
final UTDChatTheme theme

Visual theme for the default UI.

stringsgetter
UTDChatStrings get strings

Resolved UI strings: the supplied custom instance, or the English defaults (UTDChatStrings.en()) when none was provided.

रिटर्न मान: UTDChatStringsThe custom strings or the English fallback.

UTDPushConfigclass
const UTDPushConfig({bool enabled = true, bool requestPermissionOnConnect = true, String androidChannelId = 'utd_chat_messages', String androidChannelName = 'Messages', String androidChannelDescription = 'Incoming chat messages', String? foregroundNotificationTitle})

Configuration for background message push (FCM) + deep-linking. Push is opt-out (enabled defaults to true), and is also gated server-side until the engine's FCM/APNs env is provisioned. Immutable and Equatable.

पैरामीटर

  • enabledboolडिफ़ॉल्ट = true

    Whether the kit wires up FCM at all. When false, no token registration and no handlers are installed.

  • requestPermissionOnConnectboolडिफ़ॉल्ट = true

    Whether PushBridge requests notification permission on connect. When false the host must request it before push works on iOS / Android 13+.

  • androidChannelIdStringडिफ़ॉल्ट = 'utd_chat_messages'

    Android notification-channel id used for the foreground/background banner.

  • androidChannelNameStringडिफ़ॉल्ट = 'Messages'

    Android notification-channel display name (shown in system settings).

  • androidChannelDescriptionStringडिफ़ॉल्ट = 'Incoming chat messages'

    Android notification-channel description (shown in system settings).

  • foregroundNotificationTitleString?

    Optional fixed title for the foreground banner. When null the sender's name from the push payload is used.

enabledfield
final bool enabled

Whether the kit wires up FCM at all. Default true.

requestPermissionOnConnectfield
final bool requestPermissionOnConnect

Whether PushBridge requests notification permission on connect. Default true.

foregroundNotificationTitlefield
final String? foregroundNotificationTitle

Optional fixed title for the foreground banner; null uses the sender's name from the payload.

UTDChatThemeclass
const UTDChatTheme({Color background, Color surface, Color onSurface, Color onSurfaceMuted, Color primary, Color onPrimary, Color danger, Color bubbleMine, Color bubbleMineText, Color bubbleTheirs, Color bubbleTheirsText, Color tick, Color tickRead, Color divider, Color composerFill})

Color tokens for the chat kit's default UI (conversation list, chat thread, message bubbles, composer). Every field has a light, WhatsApp-flavoured default, so const UTDChatTheme() is a complete usable theme; override individual tokens via copyWith. Immutable.

पैरामीटर

  • backgroundColorडिफ़ॉल्ट = Color(0xFFF2F2F7)

    Scaffold background for both screens.

  • surfaceColorडिफ़ॉल्ट = Color(0xFFFFFFFF)

    Surface behind app bars / grouped content.

  • onSurfaceColorडिफ़ॉल्ट = Color(0xFF11181C)

    Primary foreground for text/icons over background/surface.

  • onSurfaceMutedColorडिफ़ॉल्ट = Color(0xFF8A8F98)

    Muted foreground for timestamps, previews, secondary labels.

  • primaryColorडिफ़ॉल्ट = Color(0xFF6C5CE7)

    Accent / call-to-action color (send button, unread badge, links).

  • onPrimaryColorडिफ़ॉल्ट = Colors.white

    Foreground drawn on top of primary.

  • dangerColorडिफ़ॉल्ट = Color(0xFFE74C3C)

    Destructive color (failed send, recall).

  • bubbleMineColorडिफ़ॉल्ट = Color(0xFF6C5CE7)

    Background of the local user's ("mine") message bubble.

  • bubbleMineTextColorडिफ़ॉल्ट = Colors.white

    Text color inside the local user's bubble.

  • bubbleTheirsColorडिफ़ॉल्ट = Color(0xFFFFFFFF)

    Background of a peer's ("theirs") message bubble.

  • bubbleTheirsTextColorडिफ़ॉल्ट = Color(0xFF11181C)

    Text color inside a peer's bubble.

  • tickColorडिफ़ॉल्ट = Color(0xFFB0B5BD)

    Color of the delivered/sent status ticks.

  • tickReadColorडिफ़ॉल्ट = Color(0xFF34B7F1)

    Color of the read status ticks.

  • dividerColorडिफ़ॉल्ट = Color(0x1F000000)

    Divider between conversation list tiles.

  • composerFillColorडिफ़ॉल्ट = Color(0xFFFFFFFF)

    Composer input field fill.

UTDChatTheme.lightproperty
static const UTDChatTheme light

A ready-made light theme, identical to the default constructor.

UTDChatTheme.darkproperty
static const UTDChatTheme dark

A ready-made dark theme with dark backgrounds, surfaces, bubbles, and divider.

copyWithmethod
UTDChatTheme copyWith({Color? background, Color? surface, Color? onSurface, Color? onSurfaceMuted, Color? primary, Color? onPrimary, Color? danger, Color? bubbleMine, Color? bubbleMineText, Color? bubbleTheirs, Color? bubbleTheirsText, Color? tick, Color? tickRead, Color? divider, Color? composerFill})

Returns a copy of this theme with the given color tokens overridden; unspecified tokens keep their current values.

पैरामीटर

  • backgroundColor?

    Override scaffold background.

  • surfaceColor?

    Override surface color.

  • onSurfaceColor?

    Override primary foreground.

  • onSurfaceMutedColor?

    Override muted foreground.

  • primaryColor?

    Override accent color.

  • onPrimaryColor?

    Override foreground over primary.

  • dangerColor?

    Override destructive color.

  • bubbleMineColor?

    Override local bubble background.

  • bubbleMineTextColor?

    Override local bubble text.

  • bubbleTheirsColor?

    Override peer bubble background.

  • bubbleTheirsTextColor?

    Override peer bubble text.

  • tickColor?

    Override sent/delivered tick color.

  • tickReadColor?

    Override read tick color.

  • dividerColor?

    Override list divider color.

  • composerFillColor?

    Override composer fill color.

रिटर्न मान: UTDChatThemeA new theme with the requested overrides applied.

UTDChatStringsclass
const UTDChatStrings({required String conversationsTitle, required String noConversations, required String emptyChatHint, required String messageHint, required String recalledPlaceholder, required String recall, required String retry, required String cancel, required String sendFailed, required String reconnecting, required String offline, required String online, required String lastSeen, required String newGroup, required String groupName, required String groupInfo, required String membersLabel, required String addMembers, required String removeMember, required String leaveGroup, required String deleteGroup, required String renameGroup, required String create, required String save, required String roleOwner, required String roleAdmin, required String actionFailed, required String typing, required String typingNamed, required String typingMany, required String attach, required String attachPhoto, required String attachCamera, required String attachVideo, required String attachFile, required String mediaPhoto, required String mediaVideo, required String mediaAudio, required String uploading, required String uploadFailed, required String uploadsUnavailable})

User-facing strings for the chat kit's default UI (conversation list, chat thread, composer, groups, presence, typing, media). Pass a custom instance (or a factory) to UTDChatConfig.strings to translate/relabel. The const constructor requires every label; factories provide complete sets.

पैरामीटर

  • conversationsTitleStringआवश्यक

    Title of the conversation list screen.

  • messageHintStringआवश्यक

    Placeholder shown in the composer input.

  • typingNamedStringआवश्यक

    Group typing indicator for one member; `{name}` is substituted.

  • typingManyStringआवश्यक

    Group typing indicator for several members; `{count}` is substituted.

  • uploadsUnavailableStringआवश्यक

    Shown when media uploads are not configured for the project (engine 503).

UTDChatStrings.enconstructor
factory UTDChatStrings.en()

Factory returning the complete English default string set.

रिटर्न मान: UTDChatStringsAll labels populated with English defaults.

UTDChatStrings.arconstructor
factory UTDChatStrings.ar()

Factory returning the complete Arabic default string set.

रिटर्न मान: UTDChatStringsAll labels populated with Arabic defaults.

typingNamedOfmethod
String typingNamedOf(String name)

Builds the group-typing line for one named member by substituting `{name}` in typingNamed.

पैरामीटर

  • nameStringआवश्यक

    Display name/identity of the member who is typing.

रिटर्न मान: StringThe localized single-member typing line.

typingManyOfmethod
String typingManyOf(int count)

Builds the group-typing line for several members by substituting `{count}` in typingMany.

पैरामीटर

  • countintआवश्यक

    Number of members currently typing.

रिटर्न मान: StringThe localized multi-member typing line.

Conversations & messages

The conversation/message data models, the message-status lifecycle enum, and the controllers plus optimistic outbox that drive one thread and the conversation list — watching the local-first Drift store, sending/recalling messages, and reconciling on the engine ack.

UTDChatMessageclass
const UTDChatMessage({required int localId, String? clientMsgId, String? messageId, required String conversationId, required String senderIdentity, String? senderName, String? content, String type = 'text', UTDSystemEvent? systemEvent, UTDMediaAttachment? attachment, required UTDMessageStatus status, required DateTime createdAt, required bool isMine})

An immutable single message projected from the local store for rendering in a chat thread. Carries the local row id, the optimistic client id and the server message id, sender info, content/type, parsed group-system-event and media-attachment payloads, delivery status, timestamp, and an isMine flag.

पैरामीटर

  • localIdintआवश्यक

    Local Drift row id; a stable widget key and ordering tiebreaker.

  • clientMsgIdString?

    Client-generated id stamped at optimistic insert; null for messages first seen from a peer.

  • messageIdString?

    Server-assigned message id, stamped once acked or on inbound; null while still sending/failed.

  • conversationIdStringआवश्यक

    The owning conversation id.

  • senderIdentityStringआवश्यक

    Identity of the message sender.

  • senderNameString?

    Sender display name, when known.

  • contentString?

    Text content, or null when recalled or for a media-only message.

  • typeStringडिफ़ॉल्ट = 'text'

    Message type: text, system_message, image, file, audio, or video.

  • systemEventUTDSystemEvent?

    Parsed group-lifecycle event, present only when type is system_message.

  • attachmentUTDMediaAttachment?

    Parsed media attachment, present only for image/file/audio/video messages.

  • statusUTDMessageStatusआवश्यक

    Delivery lifecycle status of the message.

  • createdAtDateTimeआवश्यक

    Creation time (server created_at, or local clock while pending).

  • isMineboolआवश्यक

    Whether the local user sent this message.

UTDChatMessage.fromRowconstructor
factory UTDChatMessage.fromRow(Message m, String selfIdentity)

Factory that builds a UTDChatMessage from a Drift Message row and the local self identity, parsing the system event for system_message rows and the media attachment for media rows, and deriving isMine by comparing the sender against selfIdentity.

पैरामीटर

  • mMessageआवश्यक

    The Drift message row.

  • selfIdentityStringआवश्यक

    The local user's identity, used to set isMine.

isRecalledgetter
bool get isRecalled

True when status is recalled (the message was unsent by its sender).

रिटर्न मान: boolWhether the message has been recalled.

isFailedgetter
bool get isFailed

True when status is failed (the optimistic send exhausted its retries or hit a hard error).

रिटर्न मान: boolWhether the send failed.

isPendinggetter
bool get isPending

True when status is sending (queued in the outbox, not yet acked).

रिटर्न मान: boolWhether the message is still being sent.

isSystemgetter
bool get isSystem

True when type is system_message (a centered group-lifecycle note).

रिटर्न मान: boolWhether this is a system message.

isMediagetter
bool get isMedia

True when type is image, file, audio, or video.

रिटर्न मान: boolWhether this is a media message.

UTDConversationSummaryclass
const UTDConversationSummary({required String conversationId, required String type, String? title, String? peerIdentity, String? avatarUrl, String? lastMessagePreview, DateTime? lastMessageAt, int unreadCount = 0, bool muted = false})

An immutable conversation list item projected from the local store for list rendering. Carries the conversation id and type (peer/group), display title, 1:1 peer identity, avatar, last-message preview and timestamp, unread count, and mute flag.

पैरामीटर

  • conversationIdStringआवश्यक

    Engine conversation id (stable primary key).

  • typeStringआवश्यक

    Conversation type: peer or group.

  • titleString?

    Display title: group name, or the 1:1 peer identity.

  • peerIdentityString?

    The 1:1 peer's identity (null for groups); the presence-watch target.

  • avatarUrlString?

    Avatar URL, when known.

  • lastMessagePreviewString?

    Cached preview of the most recent message.

  • lastMessageAtDateTime?

    When the most recent message landed (the list sort key).

  • unreadCountintडिफ़ॉल्ट = 0

    Unread message count for the local user.

  • mutedboolडिफ़ॉल्ट = false

    Whether the local user muted this thread.

isGroupgetter
bool get isGroup

True when type equals 'group' (UTDConversationSummary).

रिटर्न मान: boolWhether this conversation is a group.

UTDMediaAttachmentclass
const UTDMediaAttachment({required String url, String? name, int? size, String? mime, int? width, int? height, int? duration})

A media attachment projected from a message's metadata payload. The url is the R2 object_url once uploaded, or a local file path while a send is still optimistic, plus optional descriptors (name, size, mime, dimensions, duration).

पैरामीटर

  • urlStringआवश्यक

    The object URL (R2) once uploaded, or a local file path while sending.

  • nameString?

    Original file name, when known (drives the file-tile label).

  • sizeint?

    Byte size, when known (drives the human-readable size label).

  • mimeString?

    MIME content type, when known.

  • widthint?

    Pixel width for images/videos, when known.

  • heightint?

    Pixel height for images/videos, when known.

  • durationint?

    Duration in seconds for audio/video, when known.

isLocalgetter
bool get isLocal

True when url points at a local file (starts with file:// or /), i.e. an optimistic, not-yet-uploaded attachment.

रिटर्न मान: boolWhether the attachment url is a local path.

UTDMediaAttachment.fromMetadatamethod
static UTDMediaAttachment? fromMetadata(Map<String, dynamic>? m)

Parse an attachment from an already-decoded message metadata map; returns null when there is no usable url.

पैरामीटर

  • mMap<String, dynamic>?आवश्यक

    The decoded metadata map, or null.

रिटर्न मान: UTDMediaAttachment?The parsed attachment, or null when no url is present.

UTDMediaAttachment.fromJsonStringmethod
static UTDMediaAttachment? fromJsonString(String? json)

Parse an attachment from a raw metadata JSON string (the Drift metadata column); returns null when absent or malformed.

पैरामीटर

  • jsonString?आवश्यक

    The raw metadata JSON string, or null.

रिटर्न मान: UTDMediaAttachment?The parsed attachment, or null on absent/malformed input.

UTDMessageStatusenum
enum UTDMessageStatus { sending, sent, delivered, read, failed, recalled }

The delivery lifecycle of a message as stored locally. Values: sending (local-only, queued in the outbox, not yet acked), sent (acked, server message_id stamped), delivered (peer device received it; reserved, no engine webhook yet), read (peer read past this message via message.read_receipt), failed (optimistic send exhausted retries or hard error; still in the outbox for manual resend), recalled (content cleared by its sender). The status enum is unchanged by media/typing/group milestones.

UTDChatMessageStatustypedef
typedef UTDChatMessageStatus = UTDMessageStatus;

Re-export alias for UTDMessageStatus so callers can pattern-match message status without importing the store layer.

UTDChatControllerclass
UTDChatController({required UTDChatClient client, required String conversationId, String? peerIdentity, Duration typingIdleTimeout = const Duration(seconds: 4), Duration typingExpiry = const Duration(seconds: 6)})

A ChangeNotifier that drives one conversation thread. Watches the local-first Drift message stream, eagerly pulls the newest page and marks the thread read on open, sends via the optimistic outbox, recalls, debounces outbound typing and tracks inbound typing, and pages older history. Surfaces messages (oldest→newest), loadingOlder/reachedStart state, and a typingIdentities notifier.

पैरामीटर

  • clientUTDChatClientआवश्यक

    The chat session facade (store, sync, outbox, signalling).

  • conversationIdStringआवश्यक

    The conversation this controller drives.

  • peerIdentityString?

    The 1:1 peer's identity (the to_identity send target); null for a group thread (sends route by conversation_id).

  • typingIdleTimeoutDurationडिफ़ॉल्ट = const Duration(seconds: 4)

    How long after the last keystroke a typing.stop is auto-sent.

  • typingExpiryDurationडिफ़ॉल्ट = const Duration(seconds: 6)

    How long an inbound peer 'typing' is shown without a refresh before it auto-expires.

messagesgetter
List<UTDChatMessage> get messages

The current message list, oldest→newest (the natural top-to-bottom render order), updated as the Drift stream emits.

रिटर्न मान: List<UTDChatMessage>Messages in render order.

isGroupgetter
bool get isGroup

True when this thread is a group (no single peer, i.e. peerIdentity is null).

रिटर्न मान: boolWhether the thread is a group.

loadingOldergetter
bool get loadingOlder

Whether an older-history page is currently being fetched.

रिटर्न मान: boolTrue while paging older history.

reachedStartgetter
bool get reachedStart

Whether the start of history has been reached (no more older pages remain).

रिटर्न मान: boolTrue when there is no older history left.

typingIdentitiesfield
final ValueNotifier<Set<String>> typingIdentities

A ValueNotifier of the set of OTHER identities currently typing in this conversation; self is never included and entries auto-expire after the typing-expiry window.

sendTextmethodasync
Future<void> sendText(String text)

Optimistically send a text message. Trims the body and ignores empties, ends the local typing burst, and enqueues via the outbox so the bubble appears immediately with status sending and flips to sent on the engine ack.

पैरामीटर

  • textStringआवश्यक

    The message body (trimmed; empty input is a no-op).

रिटर्न मान: Future<void>Completes once the message is enqueued.

recallmethodasync
Future<void> recall(UTDChatMessage message)

Recall (unsend) one of your own sent messages: optimistically clears it locally then asks the engine; on failure the next history pull restores truth. No-op unless the message is mine and has a server message id.

पैरामीटर

  • messageUTDChatMessageआवश्यक

    The message to recall (must be mine with a server id).

रिटर्न मान: Future<void>Completes once the recall is attempted.

retryFailedmethodasync
Future<void> retryFailed()

Retry failed messages by re-arming their backoff and draining the outbox (delegates to the outbox resendAll).

रिटर्न मान: Future<void>Completes once the outbox has been re-drained.

markReadmethodasync
Future<void> markRead()

Mark this conversation read: clears the local unread count and notifies the engine; offline read clears persist locally and re-assert on the next connected send/read.

रिटर्न मान: Future<void>Completes once read is recorded locally and attempted on the engine.

loadOldermethodasync
Future<void> loadOlder()

Page older history before the oldest local message; updates loadingOlder/reachedStart. No-op when already loading or the start has been reached.

रिटर्न मान: Future<void>Completes once the older page has been fetched (or no-op).

onInputChangedmethod
void onInputChanged(String text)

Report a composer change: sends a single typing.start on the first change of a burst and re-arms the idle timer that auto-sends typing.stop. No-op while disconnected; empty/whitespace input clears typing.

पैरामीटर

  • textStringआवश्यक

    Current composer text; empty/whitespace stops typing immediately.

clearTypingmethod
void clearTyping()

Stop the local typing burst immediately (idempotent). Called on send, on a cleared composer, and on dispose.

UTDConversationsControllerclass
UTDConversationsController(UTDChatClient client)

A ChangeNotifier that watches the conversation list from the local Drift store (most-recent-first) and exposes it as a local-first list that renders instantly and updates as the sync engine refreshes the cache.

पैरामीटर

  • clientUTDChatClientआवश्यक

    The chat session facade providing the store and sync engine.

conversationsgetter
List<UTDConversationSummary> get conversations

The current conversation list, most-recent-first.

रिटर्न मान: List<UTDConversationSummary>Conversation summaries in display order.

totalUnreadgetter
int get totalUnread

Total unread message count summed across all conversations.

रिटर्न मान: intAggregate unread count.

refreshmethodasync
Future<void> refresh()

Force a refresh of the conversation list from the engine (the live socket already keeps it current; this is for pull-to-refresh).

रिटर्न मान: Future<void>Completes once the conversation list has been pulled.

Outboxclass
Outbox({required ChatDatabase db, required UTDSignalClient signal, required String selfIdentity, int maxAttempts = 8, Duration baseBackoff = const Duration(seconds: 2), Duration maxBackoff = const Duration(minutes: 5)})

The optimistic-send pipeline (advanced/headless use). enqueueText/enqueueMedia perform a two-step write (a local message row plus a sync_outbox row); drain flushes due rows through the signalling client, stamping the server message_id and flipping status to sent on the ack then deleting the outbox row. Failed attempts back off exponentially with jitter and are retried; after maxAttempts the message is left failed for manual resend.

पैरामीटर

  • dbChatDatabaseआवश्यक

    The local Drift store.

  • signalUTDSignalClientआवश्यक

    The signalling client used to send messages to the engine.

  • selfIdentityStringआवश्यक

    The local user's identity, stamped as the sender on optimistic rows.

  • maxAttemptsintडिफ़ॉल्ट = 8

    Maximum send attempts before a message is left failed.

  • baseBackoffDurationडिफ़ॉल्ट = const Duration(seconds: 2)

    Base delay for exponential backoff between attempts.

  • maxBackoffDurationडिफ़ॉल्ट = const Duration(minutes: 5)

    Cap on the backoff delay.

maxAttemptsfield
final int maxAttempts

Maximum number of send attempts before a queued message is left failed (default 8).

enqueueTextmethodasync
Future<String> enqueueText({required String conversationId, String? toIdentity, required String content})

Optimistically enqueue a text send and return the client_msg_id (also the dedup key). The local message appears in the conversation stream immediately with status sending; pass toIdentity for a 1:1 peer send or leave it null for a group send routed by conversation_id.

पैरामीटर

  • conversationIdStringआवश्यक

    Target conversation id.

  • toIdentityString?

    Peer identity for a 1:1 send (engine to_identity path); null for a group send.

  • contentStringआवश्यक

    The text body to send.

रिटर्न मान: Future<String>The client_msg_id of the optimistic local row.

enqueueMediamethodasync
Future<String> enqueueMedia({required String conversationId, String? toIdentity, required String type, required Map<String, dynamic> metadata, String content = ''})

Optimistically enqueue a media send (image/file/audio/video) after the R2 upload completed. metadata carries the url (object_url) plus optional descriptors; the local row appears immediately as sending with the metadata so the bubble renders right away, and the engine ack stamps the message_id like the text path.

पैरामीटर

  • conversationIdStringआवश्यक

    Target conversation id.

  • toIdentityString?

    Peer identity for a 1:1 send; null for a group send.

  • typeStringआवश्यक

    Media kind: image, file, audio, or video.

  • metadataMap<String, dynamic>आवश्यक

    Payload carrying url plus optional name/size/mime/width/height/duration.

  • contentStringडिफ़ॉल्ट = ''

    Optional caption (defaults to empty).

रिटर्न मान: Future<String>The client_msg_id of the optimistic local row.

drainmethodasync
Future<void> drain()

Flush every due outbox row once through the signalling client. Safe to call repeatedly or concurrently; re-entrant calls are coalesced.

रिटर्न मान: Future<void>Completes once all due rows have been attempted.

resendAllmethodasync
Future<void> resendAll()

Retry every queued row immediately (used on reconnect): clears the backoff gate, resets failed messages back to sending, then drains.

रिटर्न मान: Future<void>Completes once all queued rows have been re-attempted.

Groups & members

Group-chat domain: the role enum (owner/admin/member), the group-member model, and the server-authoritative group lifecycle controller and screens for creating, inviting, removing, renaming, leaving, and deleting groups.

UTDGroupRoleenum
enum UTDGroupRole { owner, admin, member }

A member's role within a group conversation, mirroring the engine's conversation_members.role. Values: owner (created the group or was promoted on owner-leave handoff; can delete, add/remove members, rename), admin (can add/remove members and rename, but not delete), member (regular participant; can only leave). Unknown/absent wire values degrade to member so the local gate never over-grants.

UTDGroupRole.fromWiremethod
static UTDGroupRole fromWire(String? s)

Parses a wire role string into a UTDGroupRole; unknown or null values degrade to the least-privileged member role.

पैरामीटर

  • sString?आवश्यक

    The wire role string ('owner', 'admin', anything else).

रिटर्न मान: UTDGroupRoleThe matching role, or UTDGroupRole.member for unknown/null input.

wiregetter
String get wire

The wire string for this role (the enum value's name).

रिटर्न मान: String'owner', 'admin', or 'member'.

canManageMembersgetter
bool get canManageMembers

Whether this role can add/remove members and rename the group (owner or admin).

रिटर्न मान: boolTrue for owner and admin.

canUpdateGroupgetter
bool get canUpdateGroup

Whether this role can update the group's name/avatar (owner or admin; equal to canManageMembers).

रिटर्न मान: boolTrue for owner and admin.

canDeleteGroupgetter
bool get canDeleteGroup

Whether this role can delete the whole group (owner only).

रिटर्न मान: boolTrue only for owner.

UTDGroupMemberclass
const UTDGroupMember({required String identity, required UTDGroupRole role, String? nickname, DateTime? joinedAt})

An immutable projection of a group member from the local store, used by the group-info UI. Carries the member's identity, role, optional nickname and join time.

पैरामीटर

  • identityStringआवश्यक

    The member's stable identity.

  • roleUTDGroupRoleआवश्यक

    The member's role in the group.

  • nicknameString?

    A per-conversation display nickname, when set.

  • joinedAtDateTime?

    When the member joined, when known.

identityfield
final String identity

The member's stable identity.

rolefield
final UTDGroupRole role

The member's role within the group (owner/admin/member).

nicknamefield
final String? nickname

A per-conversation display nickname, when set; null otherwise.

joinedAtfield
final DateTime? joinedAt

When the member joined the group, when known.

displayNamegetter
String get displayName

Display label for the member: the nickname when set, otherwise the identity.

रिटर्न मान: StringThe nickname, or the identity as a fallback.

UTDGroupMember.fromRowmethod
factory UTDGroupMember.fromRow(ConversationMember m)

Builds a UTDGroupMember from a Drift ConversationMember store row, parsing the wire role and converting joinedAt from epoch milliseconds.

पैरामीटर

  • mConversationMemberआवश्यक

    The cached store row for this member.

रिटर्न मान: UTDGroupMemberThe projected member.

UTDGroupsControllerclass
UTDGroupsController({required UTDChatClient client, required String conversationId})

A ChangeNotifier that drives one group's membership and management actions for the group-info UI. Watches the local member cache, exposes the live member list and the local user's role, and performs server-authoritative mutations; each mutation throws a UTDStreamException on engine rejection (e.g. ack code 3 'Only owner/admin …'). Live conversation.* pushes keep the cache and myRole current. Use the static create() for the create-group flow where no conversation exists yet.

पैरामीटर

  • clientUTDChatClientआवश्यक

    The chat session facade providing the signal transport, store and sync engine.

  • conversationIdStringआवश्यक

    The id of the group conversation this controller manages.

conversationIdfield
final String conversationId

The id of the group conversation this controller manages.

membersgetter
List<UTDGroupMember> get members

The current member list (owner/admin/member, in join order), kept live from the local member cache.

रिटर्न मान: List<UTDGroupMember>The cached group members.

myRolegetter
UTDGroupRole get myRole

The local user's role in this group; defaults to UTDGroupRole.member until the cache resolves so the UI gate never over-grants.

रिटर्न मान: UTDGroupRoleThe local user's role, or member when unknown.

canManagegetter
bool get canManage

Whether the local user is a member and may add/remove members and rename the group.

रिटर्न मान: boolTrue when the user is an owner or admin member.

canDeletegetter
bool get canDelete

Whether the local user is a member and may delete the whole group (owner only).

रिटर्न मान: boolTrue when the user is the owner.

addMembersmethodasync
Future<void> addMembers(List<String> identities)

Adds members (invites identities) to the group, then refreshes the authoritative member set. Throws UTDStreamException if the engine rejects (e.g. a concurrent demotion stripped manage rights — ack code 3).

पैरामीटर

  • identitiesList<String>आवश्यक

    The identities to add to the group.

रिटर्न मान: Future<void>Completes once the add is acked and the member cache is refreshed.

removeMembermethodasync
Future<void> removeMember(String identity)

Removes a member from the group, then refreshes the member set. Throws on rejection (caller not owner/admin, or the target is the owner).

पैरामीटर

  • identityStringआवश्यक

    The identity of the member to remove.

रिटर्न मान: Future<void>Completes once the removal is acked and the cache is refreshed.

leavemethodasync
Future<void> leave()

Leaves this group. The engine excludes the leaver from the member_left push, so the local thread is evicted here on a successful ack.

रिटर्न मान: Future<void>Completes once the leave is acked and the conversation is evicted locally.

updateGroupmethodasync
Future<void> updateGroup({String? name, String? avatarUrl})

Renames and/or re-avatars the group. Throws on rejection when the caller lacks update rights.

पैरामीटर

  • nameString?

    The new group name, when changing it.

  • avatarUrlString?

    The new group avatar URL, when changing it.

रिटर्न मान: Future<void>Completes once the update is acked.

setMutedmethodasync
Future<void> setMuted(bool muted)

Mutes or unmutes the group for the local user and updates the local conversation cache.

पैरामीटर

  • mutedboolआवश्यक

    True to mute, false to unmute.

रिटर्न मान: Future<void>Completes once the mute state is applied.

deleteGroupmethodasync
Future<void> deleteGroup()

Deletes the whole group (owner only). Throws on rejection. The engine excludes the deleter from the conversation.deleted push, so the local thread is evicted here on a successful ack.

रिटर्न मान: Future<void>Completes once the delete is acked and the conversation is evicted locally.

UTDGroupsController.createmethodasync
static Future<String> create(UTDChatClient client, {required List<String> members, required String name, String? avatarUrl})

Creates a new group and returns its conversation id. Static because there is no conversation to bind to yet; the resulting conversation.group_created push (handled by the sync engine) materializes the local thread and members.

पैरामीटर

  • clientUTDChatClientआवश्यक

    The chat session facade used to issue the create-group signal.

  • membersList<String>आवश्यक

    The initial member identities to add to the new group.

  • nameStringआवश्यक

    The new group's name.

  • avatarUrlString?

    An optional group avatar URL.

रिटर्न मान: Future<String>The new group's conversation id.

disposemethod
void dispose()

Cancels the member-cache subscription and disposes the ChangeNotifier.

UTDCreateGroupScreenwidget
const UTDCreateGroupScreen({Key? key, List<String> initialMembers = const [], bool openOnCreate = true})

A create-group screen with a name field and a comma-separated member-id entry. On submit it creates the group via UTDGroupsController.create; the resulting conversation.group_created push materializes the thread, and when openOnCreate is set the screen replaces itself with the new group's UTDChatScreen. The kit owns no contact directory, so hosts with one should pass initialMembers or wrap their own picker around the controller's create.

पैरामीटर

  • keyKey?

    The widget key.

  • initialMembersList<String>डिफ़ॉल्ट = const []

    Pre-filled member identities (e.g. from a host-supplied picker).

  • openOnCreateboolडिफ़ॉल्ट = true

    Whether to push the new group's chat screen on success.

UTDCreateGroupScreen.showSheetmethodasync
static Future<String?> showSheet(BuildContext context, {List<String> initialMembers = const []})

Presents the create-group screen as a modal bottom sheet. Returns the new conversation id, or null if cancelled.

पैरामीटर

  • contextBuildContextआवश्यक

    The build context (must be under a UTDChatScope).

  • initialMembersList<String>डिफ़ॉल्ट = const []

    Pre-filled member identities.

रिटर्न मान: Future<String?>The new conversation id, or null if the sheet was dismissed.

UTDGroupInfoScreenwidget
const UTDGroupInfoScreen({Key? key, required String conversationId, String? title})

A group-info screen showing the member list with roles plus management actions: add/remove members, rename, leave, and (owner only) delete. Management controls are gated on the local user's role via a UTDGroupsController, but the server is authoritative — a racing rejection (ack code 3) is caught and surfaced as a snackbar while the live member-list refresh re-asserts the truth.

पैरामीटर

  • keyKey?

    The widget key.

  • conversationIdStringआवश्यक

    The id of the group conversation to show info for.

  • titleString?

    The group title to display and pre-fill in the rename dialog.

Presence & typing

Real-time online/last-seen presence (controller, model, dot widget) and ephemeral typing indicators (typing event model plus the chat controller's typing relay), backed by the signalling client's presence/typing methods and streams.

UTDPresenceControllerclass
UTDPresenceController(UTDChatClient _client, {Duration staleAfter = const Duration(minutes: 5), Duration sweepInterval = const Duration(minutes: 1)})

A ChangeNotifier that tracks online/offline presence of peers the UI cares about. It subscribes over the signalling socket (`presence.subscribe`, which also returns current statuses), folds live `presence.changed` pushes into a local cache, derives a best-effort `last_seen` on each online→offline transition, re-queries on reconnect, and expires snapshots not refreshed within `staleAfter` (degrading them to `UTDPresenceStatus.unknown`).

पैरामीटर

  • _clientUTDChatClientआवश्यक

    The chat client whose signalling socket and connection state this controller watches (positional).

  • staleAfterDurationडिफ़ॉल्ट = const Duration(minutes: 5)

    How long a snapshot stays trusted without a refresh before degrading to UTDPresenceStatus.unknown.

  • sweepIntervalDurationडिफ़ॉल्ट = const Duration(minutes: 1)

    How often the controller sweeps the cache to expire stale snapshots.

staleAfterfield
final Duration staleAfter

How long a presence snapshot stays trusted without a refresh before its status degrades to UTDPresenceStatus.unknown.

snapshotOfmethod
UTDPresenceSnapshot? snapshotOf(String identity)

Returns the current presence snapshot for the given identity, or null if it is not tracked.

पैरामीटर

  • identityStringआवश्यक

    The identity to look up in the presence cache.

रिटर्न मान: UTDPresenceSnapshot?The cached snapshot, or null if the identity is not tracked.

statusOfmethod
UTDPresenceStatus statusOf(String identity)

Convenience accessor for an identity's status, defaulting to UTDPresenceStatus.unknown when it is not tracked.

पैरामीटर

  • identityStringआवश्यक

    The identity whose status to read.

रिटर्न मान: UTDPresenceStatusThe cached status, or UTDPresenceStatus.unknown if not tracked.

isOnlinemethod
bool isOnline(String identity)

Whether the given identity is currently known to be online.

पैरामीटर

  • identityStringआवश्यक

    The identity to test.

रिटर्न मान: boolTrue only when the cached status is UTDPresenceStatus.online.

watchmethodasync
Future<void> watch(List<String> identities)

Subscribes to and immediately fetches presence for the given identities, folding the returned statuses into the cache. No-ops on an empty list and ignores blank identities; errors are swallowed (best-effort) and a later reconnect re-queries.

पैरामीटर

  • identitiesList<String>आवश्यक

    The identities to start watching (blank entries are skipped).

रिटर्न मान: Future<void>Completes after the subscribe request resolves (or is swallowed when disconnected/rate-limited).

unwatchmethodasync
Future<void> unwatch(List<String> identities)

Stops watching the given identities: removes them from the watched set and the cache and best-effort unsubscribes over the socket, then notifies listeners.

पैरामीटर

  • identitiesList<String>आवश्यक

    The identities to stop watching; entries not currently watched are ignored.

रिटर्न मान: Future<void>Completes after the unsubscribe request resolves or is swallowed.

disposemethod
void dispose()

Cancels the sweep timer and presence subscription, detaches the connection-state listener, and disposes the controller.

UTDPresenceStatusenum

Online/offline status of an identity on the signalling plane. Values: online, offline, unknown. Exposes the static helper `UTDPresenceStatus.fromWire(String? s)` which maps the wire strings 'online'/'offline' to the matching value and anything else to unknown.

UTDPresenceSnapshotclass
const UTDPresenceSnapshot({required String identity, required UTDPresenceStatus status, DateTime? lastSeen, required DateTime updatedAt})

A point-in-time presence snapshot for one identity as cached by a kit. The engine's presence plane is binary and timestamp-less, so lastSeen is a best-effort local marker (the local clock at the observed online→offline transition) and updatedAt is when the snapshot was last touched (used to expire stale entries).

पैरामीटर

  • identityStringआवश्यक

    The identity this snapshot describes.

  • statusUTDPresenceStatusआवश्यक

    Online/offline/unknown status.

  • lastSeenDateTime?

    Best-effort 'last seen online' local wall-clock time, set when the identity is offline after a prior online→offline transition.

  • updatedAtDateTimeआवश्यक

    When this snapshot was last updated (local clock).

isOnlinegetter
bool get isOnline

Whether this snapshot's status is UTDPresenceStatus.online.

copyWithmethod
UTDPresenceSnapshot copyWith({UTDPresenceStatus? status, DateTime? lastSeen, DateTime? updatedAt})

Returns a copy of this snapshot with the given fields replaced (identity is preserved).

पैरामीटर

  • statusUTDPresenceStatus?

    Replacement status, or keep the current one.

  • lastSeenDateTime?

    Replacement last-seen time, or keep the current one.

  • updatedAtDateTime?

    Replacement update timestamp, or keep the current one.

रिटर्न मान: UTDPresenceSnapshotA new snapshot with the overrides applied.

UTDPresenceChangeclass
const UTDPresenceChange({required String identity, required UTDPresenceStatus status})

A presence transition pushed over the WebSocket (`presence.changed`), carrying the identity and its new status. Constructed from wire data via the `UTDPresenceChange.fromData(Map<String, dynamic> d)` factory.

पैरामीटर

  • identityStringआवश्यक

    The identity whose presence changed.

  • statusUTDPresenceStatusआवश्यक

    Their new status.

UTDTypingEventclass
const UTDTypingEvent({required String conversationId, required String identity, required bool typing})

An ephemeral typing transition pushed over the WebSocket (`typing`). The engine relays start/stop to other conversation members and never persists or bills it. `typing` is true on typing.start and false on typing.stop. Constructed from wire data via the `UTDTypingEvent.fromData(Map<String, dynamic> d)` factory.

पैरामीटर

  • conversationIdStringआवश्यक

    The conversation the typing applies to.

  • identityStringआवश्यक

    The identity that started or stopped typing.

  • typingboolआवश्यक

    Whether the identity is currently typing in the conversation.

UTDPresenceDotwidget
const UTDPresenceDot({Key? key, required UTDPresenceStatus status, double size = 12, Color? ringColor})

A small colored dot indicating an identity's presence: green when online, the theme's muted color otherwise, and nothing at all when status is unknown. Intended to overlay an avatar or sit beside a name.

पैरामीटर

  • keyKey?

    Standard widget key.

  • statusUTDPresenceStatusआवश्यक

    The presence to render (unknown renders an empty SizedBox).

  • sizedoubleडिफ़ॉल्ट = 12

    Diameter of the dot including its ring.

  • ringColorColor?

    Color of the outline ring; defaults to the theme surface so the dot reads as a cut-out over an avatar.

presenceChangesgetter
Stream<UTDPresenceChange> get presenceChanges

Broadcast stream on the signalling client of presence transitions (`presence.changed`) for subscribed identities. The UTDPresenceController listens to this to update its cache.

subscribePresencemethodasync
Future<Map<String, UTDPresenceStatus>> subscribePresence(List<String> identities)

Signalling-client method to subscribe to presence for 1–100 identities and return their current statuses; subscriptions are restored automatically after a reconnect.

पैरामीटर

  • identitiesList<String>आवश्यक

    The identities to subscribe to (1–100).

रिटर्न मान: Future<Map<String, UTDPresenceStatus>>Current status per identity at subscribe time.

unsubscribePresencemethodasync
Future<void> unsubscribePresence(List<String> identities)

Signalling-client method to stop receiving presence for the given identities.

पैरामीटर

  • identitiesList<String>आवश्यक

    The identities to unsubscribe from.

रिटर्न मान: Future<void>Completes when the unsubscribe request resolves.

queryPresencemethodasync
Future<Map<String, UTDPresenceStatus>> queryPresence(List<String> identities)

Signalling-client method to query current presence for the given identities without subscribing. Used by the presence controller to reconcile after reconnect.

पैरामीटर

  • identitiesList<String>आवश्यक

    The identities to query.

रिटर्न मान: Future<Map<String, UTDPresenceStatus>>Current status per identity.

typingEventsgetter
Stream<UTDTypingEvent> get typingEvents

Broadcast stream on the signalling client of ephemeral typing transitions (`typing`) from other conversation members. The UTDChatController listens to this to maintain its typingIdentities set.

sendTypingStartmethodasync
Future<void> sendTypingStart(String conversationId)

Signalling-client method to signal that you started typing in a conversation; relayed to the other members.

पैरामीटर

  • conversationIdStringआवश्यक

    The conversation you are typing in.

रिटर्न मान: Future<void>Completes when the typing.start request resolves.

sendTypingStopmethodasync
Future<void> sendTypingStop(String conversationId)

Signalling-client method to signal that you stopped typing in a conversation.

पैरामीटर

  • conversationIdStringआवश्यक

    The conversation you stopped typing in.

रिटर्न मान: Future<void>Completes when the typing.stop request resolves.

typingIdentitiesproperty
final ValueNotifier<Set<String>> typingIdentities

On UTDChatController: a ValueNotifier holding the set of OTHER identities currently typing in this conversation. Self is never included; entries auto-expire after the typing-expiry window. Drives the chat header/footer typing line.

onInputChangedmethod
void onInputChanged(String text)

On UTDChatController: report that the local user changed the composer input. Sends a single typing.start on the first change of a burst and re-arms a ~4s idle timer that auto-sends typing.stop. A no-op while disconnected; an empty/whitespace body stops immediately.

पैरामीटर

  • textStringआवश्यक

    The current composer text; empty/whitespace clears typing.

clearTypingmethod
void clearTyping()

On UTDChatController: stop the local typing burst immediately (idempotent), sending typing.stop. Called on send, on a cleared composer, and on dispose.

Push, theming & i18n

FCM background/foreground push handling with device push-token registration and deep-link routing, plus the themeable color tokens and localizable strings for the kit's built-in chat UI.

utdChatFirebaseBackgroundHandlermethodasync
Future<void> utdChatFirebaseBackgroundHandler(RemoteMessage message)

Top-level FCM background message handler that MUST be registered by the host before runApp (annotated @pragma('vm:entry-point')). FCM invokes it in a separate isolate when a data message arrives while the app is backgrounded/terminated. It parses a chat deep-link from the message data (returning early if it isn't a chat-message payload), initializes Firebase + flutter_local_notifications in the isolate, and renders a local notification (title = sender name or 'New message', body = the payload 'preview') so the user can tap it; the tap is later routed via FirebaseMessaging.onMessageOpenedApp / getInitialMessage.

पैरामीटर

  • messageRemoteMessageआवश्यक

    The FCM data message delivered to the background isolate.

रिटर्न मान: Future<void>Completes once the local notification has been shown (or immediately if the payload is not a chat message).

PushBridgeclass
PushBridge({required UTDApi api, required Future<String> Function() deviceIdProvider, UTDPushConfig config = const UTDPushConfig(), FirebaseMessaging? messaging, FlutterLocalNotificationsPlugin? localNotifications})

Bridges Firebase Cloud Messaging to the chat kit: registers the device push token with the engine, keeps it fresh on refresh, renders foreground/background banners, and routes notification taps to a deep-link. Driven by UTDChatClient. It never throws into the connect path — a Firebase/permission failure degrades gracefully and is reported via debugPrint.

पैरामीटर

  • apiUTDApiआवश्यक

    Engine REST facade used to register/unregister the push token.

  • deviceIdProviderFuture<String> Function()आवश्यक

    Resolves this device's stable id, used as the push-token registration key.

  • configUTDPushConfigडिफ़ॉल्ट = const UTDPushConfig()

    Push behaviour/notification-channel configuration.

  • messagingFirebaseMessaging?

    FCM instance override (defaults to FirebaseMessaging.instance); useful in tests.

  • localNotificationsFlutterLocalNotificationsPlugin?

    Local-notifications plugin override (defaults to a new FlutterLocalNotificationsPlugin); useful in tests.

startmethodasync
Future<void> start()

Initializes FCM and wires the receive surfaces: inits local notifications + the Android channel, optionally requests notification permission (iOS / Android 13+), resolves and registers the FCM token (resolving the APNs token first on iOS), then subscribes to token refresh and the three receive surfaces (foreground, opened-from-background, cold start). Idempotent and a no-op when push is disabled; never throws.

रिटर्न मान: Future<void>Completes once initialization and registration have been attempted.

stopmethodasync
Future<void> stop()

Tears down the bridge on dispose/logout: cancels the token-refresh and message listeners and unregisters the push token with the engine so a signed-out device stops receiving pushes. Never throws.

रिटर्न मान: Future<void>Completes once listeners are cancelled and the token unregister has been attempted.

UTDPushConfigclass
const UTDPushConfig({bool enabled = true, bool requestPermissionOnConnect = true, String androidChannelId = 'utd_chat_messages', String androidChannelName = 'Messages', String androidChannelDescription = 'Incoming chat messages', String? foregroundNotificationTitle})

Configuration for background message push (FCM) + deep-linking. Push is opt-out (enabled defaults to true). Extends Equatable.

पैरामीटर

  • enabledboolडिफ़ॉल्ट = true

    Whether the kit wires up FCM at all; set false to skip all FCM wiring (no token registration, no handlers).

  • requestPermissionOnConnectboolडिफ़ॉल्ट = true

    Whether PushBridge requests notification permission on connect; when false the host must request it before push works on iOS / Android 13+.

  • androidChannelIdStringडिफ़ॉल्ट = 'utd_chat_messages'

    Android notification-channel id used for the foreground/background banner.

  • androidChannelNameStringडिफ़ॉल्ट = 'Messages'

    Android notification-channel display name shown in system settings.

  • androidChannelDescriptionStringडिफ़ॉल्ट = 'Incoming chat messages'

    Android notification-channel description shown in system settings.

  • foregroundNotificationTitleString?

    Optional fixed title for the foreground banner; when null the sender's name from the push payload is used.

UTDPushPlatformenum
enum UTDPushPlatform { ios, android, web }

The push platform the engine keys a token by, mirroring the engine contract for POST /api/v1/devices/push-token. Values: ios ('ios'), android ('android'), web ('web'). Each value carries a `wire` String (the exact value the engine expects in the platform field). Re-exported from utd_signaling.

registerPushTokenmethodasync
Future<bool> registerPushToken({required UTDPushPlatform platform, String? fcmToken, String? voipToken, String? deviceId})

Registers this device's push token with the engine (POST /api/v1/devices/push-token, Bearer). The engine binds the token to the bearer's identity, so a session must already be minted. Pass fcmToken (Android/web/data) and/or voipToken (iOS VoIP) as available. Returns true when the engine confirms ({registered:true}). Defined on UTDApi (from utd_signaling) and used by PushBridge.

पैरामीटर

  • platformUTDPushPlatformआवश्यक

    The platform the token is for (ios/android/web).

  • fcmTokenString?

    FCM token for Android/web/data messages.

  • voipTokenString?

    iOS VoIP push token.

  • deviceIdString?

    Device id key; defaults to the persisted UTDDeviceId.

रिटर्न मान: Future<bool>True when the engine confirms registration.

unregisterPushTokenmethodasync
Future<bool> unregisterPushToken({String? deviceId})

Unregisters this device's push token (DELETE /api/v1/devices/push-token, Bearer), called on logout/dispose so a signed-out device stops receiving pushes for this identity. Returns true when the engine confirms ({removed:true}). Defined on UTDApi (from utd_signaling) and used by PushBridge.stop().

पैरामीटर

  • deviceIdString?

    Device id key; defaults to the persisted UTDDeviceId.

रिटर्न मान: Future<bool>True when the engine confirms removal.

UTDChatDeepLinkclass
const UTDChatDeepLink({required String conversationId, String? messageId, String? senderIdentity, String? senderName})

An immutable deep-link target parsed from a {type:'message', ...} push payload, identifying the conversation (and optionally the message/sender) to open.

पैरामीटर

  • conversationIdStringआवश्यक

    The conversation to open.

  • messageIdString?

    The message that triggered the push, when present.

  • senderIdentityString?

    The sender's identity, when present.

  • senderNameString?

    The sender's display name, when present.

UTDChatDeepLink.fromDatamethod
static UTDChatDeepLink? fromData(Map<String, dynamic> data)

Static factory that parses a deep-link from an FCM data map. Returns null if it is not a chat message payload (type != 'message') or carries no non-empty conversation_id.

पैरामीटर

  • dataMap<String, dynamic>आवश्यक

    The FCM message data map.

रिटर्न मान: UTDChatDeepLink?The parsed deep-link, or null if the payload is not a chat message.

UTDChatDeepLinkHandlertypedef
typedef UTDChatDeepLinkHandler = void Function(UTDChatDeepLink link)

A host-supplied callback that navigates to the chat screen for a deep-link. Signature: void Function(UTDChatDeepLink link).

UTDNotificationRouterclass
UTDNotificationRouter.instance

Process-wide router that delivers push deep-links to the host's navigation, guarded behind chat-client readiness. dispatch QUEUES the latest deep-link and only delivers it once both a handler is set AND the router is ready; the most-recent deep-link wins. Accessed via the static `instance` singleton (no public constructor).

instancegetter
static final UTDNotificationRouter instance

The process-wide UTDNotificationRouter singleton.

fromDataOrNullmethod
static UTDChatDeepLink? fromDataOrNull(Map<String, dynamic> data)

Static helper that parses a chat deep-link from an FCM data map, or returns null if it isn't a {type:'message', conversation_id, ...} payload. Tolerates the Map<String, dynamic> shape FCM delivers.

पैरामीटर

  • dataMap<String, dynamic>आवश्यक

    The FCM message data map.

रिटर्न मान: UTDChatDeepLink?The parsed deep-link, or null.

isReadygetter
bool get isReady

Whether the chat client is connected/authenticated and able to open a conversation. On UTDNotificationRouter.

setHandlermethod
void setHandler(UTDChatDeepLinkHandler? handler)

Registers the host's navigation callback (or clears it with null). Flushes any pending deep-link if the router is already marked ready. On UTDNotificationRouter.

पैरामीटर

  • handlerUTDChatDeepLinkHandler?

    The host navigation callback, or null to clear it.

markReadymethod
void markReady()

Marks the chat client ready (connected) and flushes any queued deep-link. On UTDNotificationRouter.

markNotReadymethod
void markNotReady()

Marks the chat client not ready (e.g. on dispose/logout); subsequent deep-links queue until the next markReady. On UTDNotificationRouter.

dispatchmethod
void dispatch(UTDChatDeepLink link)

Routes a deep-link: delivers it immediately if the router is ready and a handler is set, otherwise queues it (most-recent wins). On UTDNotificationRouter.

पैरामीटर

  • linkUTDChatDeepLinkआवश्यक

    The deep-link to route.

UTDActiveConversationclass
abstract final class UTDActiveConversation

Process-wide static tracker of the conversation the user is currently viewing, used so the push layer can suppress the foreground banner for a message that arrives in the conversation the user is already reading. A single process-wide value (abstract final, all-static). The chat thread sets it while on screen and clears it on dispose/background.

conversationIdgetter
static String? get conversationId

The conversation id currently on screen, or null if none. Static, on UTDActiveConversation.

isViewingmethod
static bool isViewing(String? id)

True when the given id is the conversation currently being viewed. Static, on UTDActiveConversation.

पैरामीटर

  • idString?आवश्यक

    The conversation id to test against the active one.

रिटर्न मान: boolTrue if id matches the active conversation.

entermethod
static void enter(String id)

Marks the given conversation id as the one now on screen. Static, on UTDActiveConversation.

पैरामीटर

  • idStringआवश्यक

    The conversation now being viewed.

leavemethod
static void leave(String id)

Clears the given conversation id as active, but only if it is still the active one (so a fast A→B→dispose-A ordering doesn't clobber B). Static, on UTDActiveConversation.

पैरामीटर

  • idStringआवश्यक

    The conversation being left.

UTDChatThemeclass
const UTDChatTheme({Color background = const Color(0xFFF2F2F7), Color surface = const Color(0xFFFFFFFF), Color onSurface = const Color(0xFF11181C), Color onSurfaceMuted = const Color(0xFF8A8F98), Color primary = const Color(0xFF6C5CE7), Color onPrimary = Colors.white, Color danger = const Color(0xFFE74C3C), Color bubbleMine = const Color(0xFF6C5CE7), Color bubbleMineText = Colors.white, Color bubbleTheirs = const Color(0xFFFFFFFF), Color bubbleTheirsText = const Color(0xFF11181C), Color tick = const Color(0xFFB0B5BD), Color tickRead = const Color(0xFF34B7F1), Color divider = const Color(0x1F000000), Color composerFill = const Color(0xFFFFFFFF)})

Immutable color tokens for the kit's built-in default UI (conversation list, chat thread, message bubbles, composer). Every field has a light, WhatsApp-flavoured default, so const UTDChatTheme() is a complete, usable theme. Notable fields: background, surface, onSurface, onSurfaceMuted, primary, onPrimary, danger, bubbleMine, bubbleMineText, bubbleTheirs, bubbleTheirsText, tick, tickRead, divider, composerFill. Provides ready-made `light` and `dark` static themes and copyWith for rebranding.

पैरामीटर

  • backgroundColorडिफ़ॉल्ट = Color(0xFFF2F2F7)

    Scaffold background for both screens.

  • surfaceColorडिफ़ॉल्ट = Color(0xFFFFFFFF)

    Surface behind app bars / grouped content.

  • onSurfaceColorडिफ़ॉल्ट = Color(0xFF11181C)

    Primary foreground for text/icons over background/surface.

  • onSurfaceMutedColorडिफ़ॉल्ट = Color(0xFF8A8F98)

    Muted foreground for timestamps, previews, secondary labels.

  • primaryColorडिफ़ॉल्ट = Color(0xFF6C5CE7)

    Accent / call-to-action color (send button, unread badge, links).

  • onPrimaryColorडिफ़ॉल्ट = Colors.white

    Foreground drawn on top of primary.

  • dangerColorडिफ़ॉल्ट = Color(0xFFE74C3C)

    Destructive color (failed send, recall).

  • bubbleMineColorडिफ़ॉल्ट = Color(0xFF6C5CE7)

    Background of the local user's ('mine') message bubble.

  • bubbleMineTextColorडिफ़ॉल्ट = Colors.white

    Text color inside the local user's bubble.

  • bubbleTheirsColorडिफ़ॉल्ट = Color(0xFFFFFFFF)

    Background of a peer's ('theirs') message bubble.

  • bubbleTheirsTextColorडिफ़ॉल्ट = Color(0xFF11181C)

    Text color inside a peer's bubble.

  • tickColorडिफ़ॉल्ट = Color(0xFFB0B5BD)

    Color of the delivered/sent status ticks.

  • tickReadColorडिफ़ॉल्ट = Color(0xFF34B7F1)

    Color of the read status ticks.

  • dividerColorडिफ़ॉल्ट = Color(0x1F000000)

    Divider between conversation list tiles.

  • composerFillColorडिफ़ॉल्ट = Color(0xFFFFFFFF)

    Composer input field fill.

lightproperty
static const UTDChatTheme light

A ready-made light UTDChatTheme (identical to the default constructor). Static const on UTDChatTheme.

darkproperty
static const UTDChatTheme dark

A ready-made dark UTDChatTheme with dark background/surface, white foregrounds and a dark peer bubble. Static const on UTDChatTheme.

copyWithmethod
UTDChatTheme copyWith({Color? background, Color? surface, Color? onSurface, Color? onSurfaceMuted, Color? primary, Color? onPrimary, Color? danger, Color? bubbleMine, Color? bubbleMineText, Color? bubbleTheirs, Color? bubbleTheirsText, Color? tick, Color? tickRead, Color? divider, Color? composerFill})

Returns a copy of this UTDChatTheme with the given color tokens overridden, leaving the rest unchanged — used to rebrand without replacing whole widgets.

रिटर्न मान: UTDChatThemeA new theme with the supplied overrides applied.

UTDChatStringsclass
const UTDChatStrings({required String conversationsTitle, required String noConversations, required String emptyChatHint, required String messageHint, required String recalledPlaceholder, required String recall, required String retry, required String cancel, required String sendFailed, required String reconnecting, required String offline, required String online, required String lastSeen, required String newGroup, required String groupName, required String groupInfo, required String membersLabel, required String addMembers, required String removeMember, required String leaveGroup, required String deleteGroup, required String renameGroup, required String create, required String save, required String roleOwner, required String roleAdmin, required String actionFailed, required String typing, required String typingNamed, required String typingMany, required String attach, required String attachPhoto, required String attachCamera, required String attachVideo, required String attachFile, required String mediaPhoto, required String mediaVideo, required String mediaAudio, required String uploading, required String uploadFailed, required String uploadsUnavailable})

Immutable set of user-facing strings for the kit's built-in default UI. Notable fields include conversationsTitle, noConversations, emptyChatHint, messageHint, recalledPlaceholder, recall, retry, cancel, sendFailed, reconnecting, offline, online, lastSeen, group labels (newGroup, groupName, groupInfo, membersLabel, addMembers, removeMember, leaveGroup, deleteGroup, renameGroup, create, save, roleOwner, roleAdmin, actionFailed), typing indicators (typing, typingNamed with {name}, typingMany with {count}), and media labels (attach, attachPhoto, attachCamera, attachVideo, attachFile, mediaPhoto, mediaVideo, mediaAudio, uploading, uploadFailed, uploadsUnavailable). All fields are required in the const constructor; use the UTDChatStrings.en()/ar() factories for defaults. Pass an instance to UTDChatConfig.strings to translate/relabel.

पैरामीटर

  • messageHintStringआवश्यक

    Placeholder shown in the composer input.

  • typingStringआवश्यक

    1:1 typing indicator (the peer is typing).

  • typingNamedStringआवश्यक

    Group typing indicator for a single named member; {name} is substituted.

  • typingManyStringआवश्यक

    Group typing indicator for several members; {count} is substituted.

  • uploadsUnavailableStringआवश्यक

    Shown when media uploads are not configured for the project (engine 503).

UTDChatStrings.enconstructor
factory UTDChatStrings.en()

Factory returning the full set of English default strings (e.g. 'Chats', 'Message', 'typing…', 'Upload failed').

रिटर्न मान: UTDChatStringsEnglish-localized strings.

UTDChatStrings.arconstructor
factory UTDChatStrings.ar()

Factory returning the full set of Arabic default strings (e.g. 'المحادثات', 'رسالة', 'يكتب…', 'فشل الرفع').

रिटर्न मान: UTDChatStringsArabic-localized strings.

typingNamedOfmethod
String typingNamedOf(String name)

Returns the group-typing line for one named member, substituting {name} in typingNamed.

पैरामीटर

  • nameStringआवश्यक

    The typing member's identity/display name.

रिटर्न मान: StringThe formatted typing line.

typingManyOfmethod
String typingManyOf(int count)

Returns the group-typing line for count members, substituting {count} in typingMany.

पैरामीटर

  • countintआवश्यक

    The number of people typing.

रिटर्न मान: StringThe formatted typing line.

UTDChatScopewidget
const UTDChatScope({Key? key, required UTDChatClient client, required UTDChatTheme theme, required UTDChatStrings strings, required Widget child})

InheritedWidget that carries the chat session's client, theme and strings down to the kit's built-in default widgets via the element tree. Routes pushed from the kit re-wrap their subtree in a fresh UTDChatScope so a new route can still read the client/theme/strings.

पैरामीटर

  • keyKey?

    Widget key.

  • clientUTDChatClientआवश्यक

    The live chat session.

  • themeUTDChatThemeआवश्यक

    Visual theme for the default UI.

  • stringsUTDChatStringsआवश्यक

    UI strings.

  • childWidgetआवश्यक

    The subtree that can read this scope.

ofmethod
static UTDChatScope of(BuildContext context)

Returns the nearest UTDChatScope from the context, asserting one exists. Static on UTDChatScope. (See also maybeOf for a nullable lookup.)

पैरामीटर

  • contextBuildContextआवश्यक

    The build context to look up from.

रिटर्न मान: UTDChatScopeThe enclosing scope (asserts non-null).

UTD के साथ बनाने के लिए तैयार हैं?

अपना अकाउंट बनाएँ, अपने मास्टर वॉलेट को फंड करें, और अपनी ज़रूरत की सेवाएँ चालू करें।