From cdd6674ac2713a382d0f539d9a3ca2d0d59b6d9f Mon Sep 17 00:00:00 2001 From: Aditya Date: Mon, 23 Nov 2026 17:33:36 +0530 Subject: [PATCH 1/3] docs(flutter): Chat SDK 5.1.2 changes and version bump Co-Authored-By: Claude Opus 5.5 --- sdk/flutter/offline-cached-data.mdx | 4 ++-- sdk/flutter/offline-enable.mdx | 4 ++-- sdk/flutter/offline-encryption.mdx | 2 +- sdk/flutter/offline-reference.mdx | 6 ++++-- sdk/flutter/offline-send.mdx | 4 ++-- sdk/flutter/offline-sync.mdx | 5 ++++- sdk/flutter/overview.mdx | 4 ++-- sdk/flutter/pin-conversation.mdx | 2 +- sdk/flutter/pin-message.mdx | 2 +- sdk/flutter/reactions.mdx | 4 ++-- sdk/flutter/real-time-listeners.mdx | 10 +++++----- sdk/flutter/save-message.mdx | 2 +- sdk/flutter/setup.mdx | 4 +++- sdk/flutter/upgrading-from-v4-guide.mdx | 2 +- 14 files changed, 31 insertions(+), 24 deletions(-) diff --git a/sdk/flutter/offline-cached-data.mdx b/sdk/flutter/offline-cached-data.mdx index fcf872f73..ec2ae6db3 100644 --- a/sdk/flutter/offline-cached-data.mdx +++ b/sdk/flutter/offline-cached-data.mdx @@ -147,7 +147,7 @@ Every remaining list read gains the same two-phase behaviour. Each has its own l | `GroupsRequest` | `fetchNext` | `GroupFetchListener` | `onCachedGroups` / `onServerGroups` | | `GroupMembersRequest` | `fetchNext` | `GroupMemberFetchListener` | `onCachedGroupMembers` / `onServerGroupMembers` | | `BannedGroupMembersRequest` | `fetchNext` | `BannedGroupMemberFetchListener` | `onCachedBannedGroupMembers` / `onServerBannedGroupMembers` | -| `ReactionsRequest` | `fetchNext` | `ReactionFetchListener` | `onCachedReactions` / `onServerReactions` | +| `ReactionsRequest` | `fetchNext`, `fetchPrevious` (since v5.1.2) | `ReactionFetchListener` | `onCachedReactions` / `onServerReactions` | | `NotificationFeedRequest` | `fetchNext` | `NotificationFeedFetchListener` | `onCachedNotificationFeedItems` / `onServerNotificationFeedItems` | On these requests — `UsersRequest`, `BlockedUsersRequest`, `GroupsRequest`, `GroupMembersRequest`, `BannedGroupMembersRequest`, `ReactionsRequest`, and `NotificationFeedRequest` — `onSuccess` and `onError` are declared `required`. When you drive the read with a `listener:`, pass `onSuccess: null, onError: null` and handle every result on the listener. @@ -185,7 +185,7 @@ class ChatUserFetchListener extends UserFetchListener { -`ReactionsRequest` caches the `fetchNext` direction; `fetchPrevious` returns the server page directly. Users, groups, members, banned members, reactions, and the notification feed are served from a per-request snapshot rather than a shared store; per-builder details live on each request's own page and in the [Configuration & API Reference](/sdk/flutter/offline-reference). +`ReactionsRequest` takes a `ReactionFetchListener` on `fetchNext` and, since v5.1.2, on `fetchPrevious`. A request object caches only the direction it fetches, so use a separate `ReactionsRequest` for each direction. Users, groups, members, banned members, reactions, and the notification feed are served from a per-request snapshot rather than a shared store; per-builder details live on each request's own page and in the [Configuration & API Reference](/sdk/flutter/offline-reference). diff --git a/sdk/flutter/offline-enable.mdx b/sdk/flutter/offline-enable.mdx index e34fc1d9e..f49ed60e7 100644 --- a/sdk/flutter/offline-enable.mdx +++ b/sdk/flutter/offline-enable.mdx @@ -37,10 +37,10 @@ Offline support requires CometChat Flutter SDK **5.1.0** or later. Add or update ```yaml dependencies: - cometchat_sdk: ^5.1.0 + cometchat_sdk: ^5.1.2 ``` -Then run `flutter pub get`. This release needs Dart **3.10+**, Flutter **3.38+**, iOS **13+**, and Android **minSdk 21**. +Version 5.1.2 is recommended, and the Flutter UI Kit 6.4.0 requires it. Then run `flutter pub get`. This release needs Dart **3.10+**, Flutter **3.38+**, iOS **13+**, and Android **minSdk 21**. If you are new to the SDK, complete the [standard setup](/sdk/flutter/setup) first; the steps below only add offline configuration to your existing `init`. diff --git a/sdk/flutter/offline-encryption.mdx b/sdk/flutter/offline-encryption.mdx index 6f902849a..d48bb543f 100644 --- a/sdk/flutter/offline-encryption.mdx +++ b/sdk/flutter/offline-encryption.mdx @@ -168,4 +168,4 @@ class _MyCacheResetListener extends OfflineCacheResetListener { CometChat.addOfflineCacheResetListener("LISTENER_ID", _MyCacheResetListener()); ``` -The cache-reset reasons are `keyLost`, `wrongKey`, `corrupted`, `escalated`, and `encryptionChanged` (turning encryption on or off between launches, which also discards any queued messages and the cached media). See [Stay in Sync](/sdk/flutter/offline-sync) for the full cache-reset flow, and the [API Reference](/sdk/flutter/offline-reference) for every field and enum. +The cache-reset reasons are `keyLost`, `wrongKey`, `corrupted`, `escalated`, `encryptionChanged` (turning encryption on or off between launches, which also discards any queued messages and the cached media), and `schemaReset` (since v5.1.2: the cache was written by a newer SDK version, for example after an app rollback, so it was rebuilt; this one is not related to encryption). If you `switch` over the reason without a `default` case, handle `schemaReset` too. See [Stay in Sync](/sdk/flutter/offline-sync) for the full cache-reset flow, and the [API Reference](/sdk/flutter/offline-reference) for every field and enum. diff --git a/sdk/flutter/offline-reference.mdx b/sdk/flutter/offline-reference.mdx index 420357c50..b957254ae 100644 --- a/sdk/flutter/offline-reference.mdx +++ b/sdk/flutter/offline-reference.mdx @@ -135,7 +135,7 @@ Each delivers the cached page first (when offline is active and a user is logged | `MessageFailureReason` | `transient` (retry likely helps), `permanent` (retry won't help), `queueOverflow` (evicted to admit a newer send), `queueFull` (new send rejected, queue full), `byteOverflow` (media exceeded the byte cap), `discarded` (removed before it could send) | | `SyncOutcome` | `caughtUp` (gap replayed exactly), `partial` (a page was ingested but more remains) | | `SyncState` | `idle`, `syncing` | -| `OfflineCacheResetReason` | `keyLost`, `wrongKey`, `corrupted`, `escalated` (unclassified failure recurred and was escalated), `encryptionChanged` (the `encryption` setting changed between launches) | +| `OfflineCacheResetReason` | `keyLost`, `wrongKey`, `corrupted`, `escalated` (unclassified failure recurred and was escalated), `encryptionChanged` (the `encryption` setting changed between launches), `schemaReset` (since v5.1.2: the cache was written by a newer SDK version, for example after an app rollback, so it was rebuilt; not encryption-related). A `switch` without a `default` case must handle `schemaReset`. | | `OfflineAtRest` | `none`, `sqlcipher`, `fieldAesGcm`, `opfsIsolation` | | `OfflineKeyStorage` | `keystore`, `software`, `asyncStorage`, `none` | | `UploadFileState` | `queued`, `requestingUrl`, `uploading`, `uploaded`, `attached`, `rejected`, `failed`, `cancelled` | @@ -172,6 +172,8 @@ Compare `CometChatException.code` against these values. The offline send and syn | `ERR_REQUEST_IN_PROGRESS` | A `MessagesRequest` or `ThreadsRequest` fetch was started while an earlier fetch on the same request object is still running. | | `ERROR_REQUEST_IN_PROGRESS` | The same, on `ReactionsRequest` and `NotificationFeedRequest`. | +`ConversationsRequest` and `BlockedUsersRequest` raise no error for this: since v5.1.2, a `fetchNext()` started while an earlier one on the same request object is still loading completes at once with an empty list, online or offline. + Media downloads fail with a typed `MediaException` carrying a `MediaErrorCode` (`offlineNotCached`, `noUrl`, `resignFailed`, `downloadFailed`, `unavailable`) rather than a string code — see [Media Caching](/sdk/flutter/offline-media-caching). ## Cached results and the `listener:` parameter @@ -188,7 +190,7 @@ The two-phase fetch, single-item, and send methods each take an optional `listen | `GroupsRequest.fetchNext` | server result only | `listener: GroupFetchListener` | | `GroupMembersRequest.fetchNext` | server result only | `listener: GroupMemberFetchListener` | | `BannedGroupMembersRequest.fetchNext` | server result only | `listener: BannedGroupMemberFetchListener` | -| `ReactionsRequest.fetchNext` | server result only | `listener: ReactionFetchListener` | +| `ReactionsRequest.fetchNext` / `fetchPrevious` (since v5.1.2) | server result only | `listener: ReactionFetchListener` | | `NotificationFeedRequest.fetchNext` | server result only | `listener: NotificationFeedFetchListener` | | `CometChat.getConversation` | server result only | `listener: ConversationDetailsListener` | | `CometChatHelper.getMessageDetails` | server result only | `listener: MessageDetailsListener` | diff --git a/sdk/flutter/offline-send.mdx b/sdk/flutter/offline-send.mdx index 9a025bf1d..9c74a604b 100644 --- a/sdk/flutter/offline-send.mdx +++ b/sdk/flutter/offline-send.mdx @@ -185,7 +185,7 @@ Every message exposes its offline state. `localMessageId` is the SDK-generated h | `permanent` | The server rejected the message, the error was not recognized, or the message's media could not be copied for the offline send. A manual retry will not help. | | `queueFull` | A new send was refused because the queue is full (count cap). | | `queueOverflow` | An older queued message was evicted to admit a newer one (`dropOldest` only). | -| `byteOverflow` | A media send was refused because caching its bytes would exceed `maxMediaCacheSize`, the budget for the whole media cache (received and queued media). | +| `byteOverflow` | A media send was refused because its file is larger than `maxMediaCacheSize`, the budget for the whole media cache (received and queued media), so it cannot fit even after the least recently used cached media is evicted. | | `discarded` | A queued message was removed before it could send: by `clearOfflineCache`, by leaving or deleting its conversation, or by logout. Reported with code `ERROR_OFFLINE_MESSAGE_DISCARDED`. (`discardLocalMessage` reports `onSuccess` instead.) | ## Inspect the Queue @@ -287,7 +287,7 @@ The outbox holds at most `maxPendingMessages` messages still trying to send (`pe | `rejectNewest` (**default**) | The new send is refused and reported with reason `queueFull`. Nothing already queued is lost. | | `dropOldest` | The oldest `pending` message is evicted to admit the new one, and reported with `onError` (reason `queueOverflow`). If there is no `pending` message to evict, the new send is refused with `queueFull`. | -A count-based refusal or eviction is reported with code `ERROR_OUTBOX_OVERFLOW` (the exact reason is in the exception details). A media send whose bytes would push the media cache over `maxMediaCacheSize` is refused with reason `byteOverflow` and code `ERROR_OUTBOX_BYTE_OVERFLOW`; nothing is evicted to make room. +A count-based refusal or eviction is reported with code `ERROR_OUTBOX_OVERFLOW` (the exact reason is in the exception details). When a media send would push the media cache over `maxMediaCacheSize`, the SDK first evicts the least recently used cached media to make room. The send is refused with reason `byteOverflow` and code `ERROR_OUTBOX_BYTE_OVERFLOW` only if the file still cannot fit, that is, when it is larger than the whole `maxMediaCacheSize` budget. A **refused** send (`queueFull` / `byteOverflow`) is never queued, so it fires **no** `onMessagePending`; it reports `onError`, and the global `OfflineMessageListener` receives `onOutboxMessageFailed(message, reason)` carrying the exact reason. diff --git a/sdk/flutter/offline-sync.mdx b/sdk/flutter/offline-sync.mdx index c0ae70827..e3dfa3847 100644 --- a/sdk/flutter/offline-sync.mdx +++ b/sdk/flutter/offline-sync.mdx @@ -213,7 +213,7 @@ If you do not need the acceptance result, call `CometChat.forceSyncNow()` with n ## When the cache resets -In rare cases the SDK cannot keep the existing cache — for example the encryption key became unrecoverable, or the database file is corrupt. When this happens it rebuilds the cache from scratch and notifies an `OfflineCacheResetListener`. Any un-sent messages that were queued are lost in the rebuild; `pendingMessagesLost` reports how many — or `null` when it cannot be known. +In rare cases the SDK cannot keep the existing cache — for example the encryption key became unrecoverable, the database file is corrupt, or the cache was written by a newer SDK version. When this happens it rebuilds the cache from scratch and notifies an `OfflineCacheResetListener`. Any un-sent messages that were queued are lost in the rebuild; `pendingMessagesLost` reports how many — or `null` when it cannot be known. @@ -239,6 +239,9 @@ CometChat.addOfflineCacheResetListener("RESET_LISTENER", ResetWatcher()); | `corrupted` | The database file is corrupt on disk. | | `escalated` | An unclassified open failure recurred across launches and was escalated to a permanent rebuild. | | `encryptionChanged` | The `encryption` setting changed, so the on-disk cache was rebuilt in the configured format. This also discards any queued messages and the cached media. | +| `schemaReset` | *Since v5.1.2.* The cache on the device was written by a newer SDK version (for example, after the app was rolled back to an older release), so it was rebuilt. Not related to encryption. | + +If your app uses a `switch` over `OfflineCacheResetReason` without a `default` case, add a case for `schemaReset`. Remove the listener with `CometChat.removeOfflineCacheResetListener("RESET_LISTENER")`. See [Encrypt the Cache](/sdk/flutter/offline-encryption) for the encryption-related reasons. diff --git a/sdk/flutter/overview.mdx b/sdk/flutter/overview.mdx index 138654728..f9b04c3e2 100644 --- a/sdk/flutter/overview.mdx +++ b/sdk/flutter/overview.mdx @@ -4,7 +4,7 @@ sidebarTitle: "Overview" description: "Add CometChat Chat SDK to Flutter apps with real-time messaging, users, groups, conversations, and cross-platform support." --- -The CometChat Chat SDK for Flutter enables real-time messaging, user management, group conversations, and more in your Flutter application. Built as a pure Dart implementation in v5, it removes the dependency on platform channels and works seamlessly across Android, iOS, Web, and desktop. +The CometChat Chat SDK for Flutter enables real-time messaging, user management, group conversations, and more in your Flutter application. Built as a pure Dart implementation in v5, it removes the dependency on platform channels and works seamlessly across Android, iOS, Web, and desktop. Since 5.1.2, the package is also WASM-compatible on Flutter web. **Faster Integration with UI Kits** @@ -25,7 +25,7 @@ Use this Chat SDK directly only if you need custom UI or advanced control. If you're migrating an existing app from CometChat SDK v4, check out the [Upgrading from v4](/sdk/flutter/upgrading-from-v4-guide) guide for breaking changes, deprecated methods, and migration instructions. -Before integrating the Chat SDK, ensure you have a [CometChat Account](https://app.cometchat.com/signup) with your App ID, Region, and Auth Key. `cometchat_sdk: ^5.1.0` requires Dart 3.10+, Flutter 3.38+, Android API Level 21+, and iOS 13+. Users must exist in CometChat to send or receive messages — see [Authentication](/sdk/flutter/authentication-overview) for details. +Before integrating the Chat SDK, ensure you have a [CometChat Account](https://app.cometchat.com/signup) with your App ID, Region, and Auth Key. `cometchat_sdk: ^5.1.2` requires Dart 3.10+, Flutter 3.38+, Android API Level 21+, and iOS 13+. Users must exist in CometChat to send or receive messages — see [Authentication](/sdk/flutter/authentication-overview) for details. ```mermaid sequenceDiagram diff --git a/sdk/flutter/pin-conversation.mdx b/sdk/flutter/pin-conversation.mdx index 4b7daa0d4..59a0548df 100644 --- a/sdk/flutter/pin-conversation.mdx +++ b/sdk/flutter/pin-conversation.mdx @@ -168,7 +168,7 @@ class Class_Name with ConversationListener { -These fire for the logged-in user's own pins — on the acting device as soon as the call succeeds, and over the socket on their other devices — and when a system pin is applied server-side. They never fire because another user pinned their own list. Remove the listener when you are done: +These fire for the logged-in user's own pins made on their other devices, and when a system pin is applied server-side. They do not fire on the device that made the call: update the UI for this device's own pin or unpin in the `onSuccess` callback of `pinConversation()` / `unpinConversation()`. If you use the Flutter UI Kit 6.3.0 or earlier, upgrade it to 6.4.0 with SDK 5.1.2. They never fire because another user pinned their own list. Remove the listener when you are done: diff --git a/sdk/flutter/pin-message.mdx b/sdk/flutter/pin-message.mdx index d76d89bc6..e97f11726 100644 --- a/sdk/flutter/pin-message.mdx +++ b/sdk/flutter/pin-message.mdx @@ -172,7 +172,7 @@ class Class_Name with MessageListener { -The device that performed the action also receives these callbacks as soon as the call succeeds — the SDK fans them out locally and drops the server's echo of the same action — so a single code path can update your UI for your own pins and for pins made by other members. Remove the listener with `CometChat.removeMessageListener("listenerId")` when it is no longer needed. +These callbacks fire for pins made by other members and from the user's other devices, not on the device that performed the action. Update the UI for this device's own pin or unpin in the `onSuccess` callback of `pinMessage()` / `unpinMessage()`. If you use the Flutter UI Kit 6.3.0 or earlier, upgrade it to 6.4.0 with SDK 5.1.2. Remove the listener with `CometChat.removeMessageListener("listenerId")` when it is no longer needed. ## Pin Limit diff --git a/sdk/flutter/reactions.mdx b/sdk/flutter/reactions.mdx index a4cbcaa33..a1170684f 100644 --- a/sdk/flutter/reactions.mdx +++ b/sdk/flutter/reactions.mdx @@ -109,7 +109,7 @@ reactionRequest.fetchNext( ## Fetch Previous -The `fetchPrevious()` method fetches the previous set of reactions for the message. +The `fetchPrevious()` method fetches the previous set of reactions for the message. Starting with v5.1.2, it also accepts an optional `listener:` parameter: pass a `ReactionFetchListener` to receive the cached reactions first, then the server's, as with `fetchNext()`. See [Offline Behaviour](#offline-behaviour). @@ -237,7 +237,7 @@ BaseMessage modifiedBaseMessage = await CometChatHelper.updateMessageWithReactio ## Offline Behaviour -With offline support enabled, `ReactionsRequest.fetchNext()` on a `ReactionFetchListener` first delivers `onCachedReactions` from the device (empty when nothing was recorded), then `onServerReactions` with the live page to reconcile by reaction id. `fetchPrevious()` does not take a listener, so it is not a two-phase read. A request object caches only the direction it fetches, so use a separate `ReactionsRequest` for each direction. Offline, a read ends with `onError` (code `ERROR_REQUEST_IN_PROGRESS` while a fetch on the same object is still running, or code `ERR_CONNECTION` with details `ERROR_INTERNET_UNAVAILABLE` for no connection) after the cached page. See [Show Cached Data](/sdk/flutter/offline-cached-data). +With offline support enabled, `ReactionsRequest.fetchNext()` on a `ReactionFetchListener` first delivers `onCachedReactions` from the device (empty when nothing was recorded), then `onServerReactions` with the live page to reconcile by reaction id. Since v5.1.2, `fetchPrevious()` also takes an optional `ReactionFetchListener` and reads the same way: cached reactions first, then the server's. A request object caches only the direction it fetches, so use a separate `ReactionsRequest` for each direction. Offline, a read ends with `onError` (code `ERROR_REQUEST_IN_PROGRESS` while a fetch on the same object is still running, or code `ERR_CONNECTION` with details `ERROR_INTERNET_UNAVAILABLE` for no connection) after the cached page. See [Show Cached Data](/sdk/flutter/offline-cached-data). | Builder method | Offline | |---|---| diff --git a/sdk/flutter/real-time-listeners.mdx b/sdk/flutter/real-time-listeners.mdx index 852e2fc85..195731118 100644 --- a/sdk/flutter/real-time-listeners.mdx +++ b/sdk/flutter/real-time-listeners.mdx @@ -189,10 +189,10 @@ With offline support enabled, `MessageListener` also receives `onMessagesSynced` | `onAIAssistantMessageReceived(AIAssistantMessage message)` | This event is triggered when a persisted AI Assistant message is received after a run completes. | | `onAIToolResultReceived(AIToolResultMessage message)` | This event is triggered when an AI tool result message is received. | | `onAIToolArgumentsReceived(AIToolArgumentMessage message)` | This event is triggered when AI tool argument messages are received. | -| `onMessagePinned(BaseMessage message)` | *Available since v5.0.7.* This event is triggered when a message is pinned. Broadcast to everyone in the conversation, and fired on the acting device as soon as the call succeeds. See [Pin A Message](/sdk/flutter/pin-message). | -| `onMessageUnpinned(BaseMessage message)` | *Available since v5.0.7.* This event is triggered when a message is unpinned. Broadcast to everyone in the conversation. | -| `onMessageSaved(BaseMessage message)` | *Available since v5.0.7.* This event is triggered when the logged-in user saves a message. Private — reaches only that user's devices. See [Save A Message](/sdk/flutter/save-message). | -| `onMessageUnsaved(BaseMessage message)` | *Available since v5.0.7.* This event is triggered when the logged-in user unsaves a message. Private — reaches only that user's devices. | +| `onMessagePinned(BaseMessage message)` | *Available since v5.0.7.* This event is triggered when a message is pinned. Broadcast to everyone in the conversation; not fired on the device that performed the action. See [Pin A Message](/sdk/flutter/pin-message). | +| `onMessageUnpinned(BaseMessage message)` | *Available since v5.0.7.* This event is triggered when a message is unpinned. Broadcast to everyone in the conversation; not fired on the device that performed the action. | +| `onMessageSaved(BaseMessage message)` | *Available since v5.0.7.* This event is triggered when the logged-in user saves a message. Private — reaches only that user's other devices; not fired on the device that performed the action. See [Save A Message](/sdk/flutter/save-message). | +| `onMessageUnsaved(BaseMessage message)` | *Available since v5.0.7.* This event is triggered when the logged-in user unsaves a message. Private — reaches only that user's other devices; not fired on the device that performed the action. | To add the `MessageListener`, you need to use the `addMessageListener()` method provided by the `CometChat` class. @@ -328,7 +328,7 @@ Once the activity/fragment where the `MessageListener` is declared is not in use ## Conversation Listener -*Available since v5.0.7.* The `ConversationListener` class delivers conversation-level events for [Pin A Conversation](/sdk/flutter/pin-conversation). Conversation pins are private to the logged-in user, so these fire for the user's own pins — on the acting device and on their other devices — and for system (`app_system`) pins applied server-side, never for another user's list. +*Available since v5.0.7.* The `ConversationListener` class delivers conversation-level events for [Pin A Conversation](/sdk/flutter/pin-conversation). Conversation pins are private to the logged-in user, so these fire for the user's own pins made on their other devices (not on the device that made the call) and for system (`app_system`) pins applied server-side, never for another user's list. | Method | Information | | --- | --- | diff --git a/sdk/flutter/save-message.mdx b/sdk/flutter/save-message.mdx index 6e1c77175..5283862a4 100644 --- a/sdk/flutter/save-message.mdx +++ b/sdk/flutter/save-message.mdx @@ -160,7 +160,7 @@ class Class_Name with MessageListener { -In Flutter, the device that performed the save **also** receives these callbacks — the SDK fans them out locally as soon as the call succeeds and drops the server's echo of the same action. The user's other devices receive them over the socket. Update your saved list from the listener alone and you cover both. +These callbacks fire on the user's other devices, not on the device that performed the save. Update your saved list for this device's own action in the `onSuccess` callback of `saveMessage()` / `unsaveMessage()`. If you use the Flutter UI Kit 6.3.0 or earlier, upgrade it to 6.4.0 with SDK 5.1.2. ## Save Limit diff --git a/sdk/flutter/setup.mdx b/sdk/flutter/setup.mdx index a666f1012..03030c196 100644 --- a/sdk/flutter/setup.mdx +++ b/sdk/flutter/setup.mdx @@ -40,9 +40,11 @@ Minimum Requirement ```yaml dependencies: - cometchat_sdk: ^5.1.0 + cometchat_sdk: ^5.1.2 ``` +Version 5.1.2 is recommended, and the Flutter UI Kit 6.4.0 requires it. Since 5.1.2, the package is also WASM-compatible on Flutter web. + Then run: ```bash flutter pub get diff --git a/sdk/flutter/upgrading-from-v4-guide.mdx b/sdk/flutter/upgrading-from-v4-guide.mdx index 88a778a80..7a8cf185f 100644 --- a/sdk/flutter/upgrading-from-v4-guide.mdx +++ b/sdk/flutter/upgrading-from-v4-guide.mdx @@ -13,7 +13,7 @@ Update your `pubspec.yaml` to the latest v5 SDK: ```yaml dependencies: - cometchat_sdk: ^5.1.0 + cometchat_sdk: ^5.1.2 ``` Then run: From 581333e2347533b678b7bd6a3755ae7a9c20fde8 Mon Sep 17 00:00:00 2001 From: Aditya Date: Mon, 23 Nov 2026 17:36:09 +0530 Subject: [PATCH 2/3] docs(flutter): queued media does not count toward the media budget Co-Authored-By: Claude Opus 5.5 --- sdk/flutter/offline-media-caching.mdx | 2 +- sdk/flutter/offline-send.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/flutter/offline-media-caching.mdx b/sdk/flutter/offline-media-caching.mdx index 0695d8691..721d162bf 100644 --- a/sdk/flutter/offline-media-caching.mdx +++ b/sdk/flutter/offline-media-caching.mdx @@ -159,6 +159,6 @@ Remove the listener with `CometChat.removeMediaDownloadListener("MEDIA_LISTENER" ## Media cache size limit -Cached media bytes are bounded by `maxMediaCacheSize` (default **500 MB**; `0` means unlimited). When the cache exceeds the limit, the least recently accessed media is deleted first until it is back under budget. Media for un-sent (queued) messages is never evicted, though it still counts toward the budget; copies held for an in-progress upload are excluded from the budget. Because protected media is never evicted, the cache can briefly exceed `maxMediaCacheSize`. Bulk list loads and syncs do not refresh an item's recency. +Cached media bytes are bounded by `maxMediaCacheSize` (default **500 MB**; `0` means unlimited). When the cache exceeds the limit, the least recently accessed media is deleted first until it is back under budget. Media for un-sent (queued) messages is never evicted and does not count toward the budget, and neither do copies held for an in-progress upload. Because protected media is never evicted, the cache can briefly exceed `maxMediaCacheSize`. Bulk list loads and syncs do not refresh an item's recency. Media is stored as files in durable, app-private per-user storage; the location is not configurable. Eviction runs silently in the background — there is no cache-limit callback. To reason about size, use `CometChat.getCacheSize()` (a `Future` of the total local bytes held) and the configured limits. See the [configuration reference](/sdk/flutter/offline-reference) for the full set of options. diff --git a/sdk/flutter/offline-send.mdx b/sdk/flutter/offline-send.mdx index 9c74a604b..379c0b30e 100644 --- a/sdk/flutter/offline-send.mdx +++ b/sdk/flutter/offline-send.mdx @@ -185,7 +185,7 @@ Every message exposes its offline state. `localMessageId` is the SDK-generated h | `permanent` | The server rejected the message, the error was not recognized, or the message's media could not be copied for the offline send. A manual retry will not help. | | `queueFull` | A new send was refused because the queue is full (count cap). | | `queueOverflow` | An older queued message was evicted to admit a newer one (`dropOldest` only). | -| `byteOverflow` | A media send was refused because its file is larger than `maxMediaCacheSize`, the budget for the whole media cache (received and queued media), so it cannot fit even after the least recently used cached media is evicted. | +| `byteOverflow` | A media send was refused because its file is larger than `maxMediaCacheSize`, the media cache budget (media of queued messages does not count toward it), so it cannot fit even after the least recently used cached media is evicted. | | `discarded` | A queued message was removed before it could send: by `clearOfflineCache`, by leaving or deleting its conversation, or by logout. Reported with code `ERROR_OFFLINE_MESSAGE_DISCARDED`. (`discardLocalMessage` reports `onSuccess` instead.) | ## Inspect the Queue From 4e61f492d033cf903853ac22b58684d03974f727 Mon Sep 17 00:00:00 2001 From: Aditya Date: Mon, 23 Nov 2026 22:29:39 +0530 Subject: [PATCH 3/3] docs(flutter): clarify the media budget and byteOverflow wording Co-Authored-By: Claude Opus 5.5 --- sdk/flutter/offline-media-caching.mdx | 2 +- sdk/flutter/offline-send.mdx | 4 ++-- sdk/flutter/pin-conversation.mdx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/flutter/offline-media-caching.mdx b/sdk/flutter/offline-media-caching.mdx index 721d162bf..0db89da19 100644 --- a/sdk/flutter/offline-media-caching.mdx +++ b/sdk/flutter/offline-media-caching.mdx @@ -159,6 +159,6 @@ Remove the listener with `CometChat.removeMediaDownloadListener("MEDIA_LISTENER" ## Media cache size limit -Cached media bytes are bounded by `maxMediaCacheSize` (default **500 MB**; `0` means unlimited). When the cache exceeds the limit, the least recently accessed media is deleted first until it is back under budget. Media for un-sent (queued) messages is never evicted and does not count toward the budget, and neither do copies held for an in-progress upload. Because protected media is never evicted, the cache can briefly exceed `maxMediaCacheSize`. Bulk list loads and syncs do not refresh an item's recency. +Cached media bytes are bounded by `maxMediaCacheSize` (default **500 MB**; `0` means unlimited). When the cache exceeds the limit, the least recently accessed media is deleted first until it is back under budget. Media for un-sent (queued) messages is never evicted and does not count toward the budget, and neither do copies held for an in-progress upload. Because protected media is never evicted, the total media on disk can be larger than `maxMediaCacheSize`. Bulk list loads and syncs do not refresh an item's recency. Media is stored as files in durable, app-private per-user storage; the location is not configurable. Eviction runs silently in the background — there is no cache-limit callback. To reason about size, use `CometChat.getCacheSize()` (a `Future` of the total local bytes held) and the configured limits. See the [configuration reference](/sdk/flutter/offline-reference) for the full set of options. diff --git a/sdk/flutter/offline-send.mdx b/sdk/flutter/offline-send.mdx index 379c0b30e..11c38b085 100644 --- a/sdk/flutter/offline-send.mdx +++ b/sdk/flutter/offline-send.mdx @@ -185,7 +185,7 @@ Every message exposes its offline state. `localMessageId` is the SDK-generated h | `permanent` | The server rejected the message, the error was not recognized, or the message's media could not be copied for the offline send. A manual retry will not help. | | `queueFull` | A new send was refused because the queue is full (count cap). | | `queueOverflow` | An older queued message was evicted to admit a newer one (`dropOldest` only). | -| `byteOverflow` | A media send was refused because its file is larger than `maxMediaCacheSize`, the media cache budget (media of queued messages does not count toward it), so it cannot fit even after the least recently used cached media is evicted. | +| `byteOverflow` | A media send was refused because its file (or, for a message with several files, its files together) is larger than `maxMediaCacheSize`, the media cache budget (media of queued messages does not count toward it), so it cannot fit even after the least recently used cached media is evicted. | | `discarded` | A queued message was removed before it could send: by `clearOfflineCache`, by leaving or deleting its conversation, or by logout. Reported with code `ERROR_OFFLINE_MESSAGE_DISCARDED`. (`discardLocalMessage` reports `onSuccess` instead.) | ## Inspect the Queue @@ -287,7 +287,7 @@ The outbox holds at most `maxPendingMessages` messages still trying to send (`pe | `rejectNewest` (**default**) | The new send is refused and reported with reason `queueFull`. Nothing already queued is lost. | | `dropOldest` | The oldest `pending` message is evicted to admit the new one, and reported with `onError` (reason `queueOverflow`). If there is no `pending` message to evict, the new send is refused with `queueFull`. | -A count-based refusal or eviction is reported with code `ERROR_OUTBOX_OVERFLOW` (the exact reason is in the exception details). When a media send would push the media cache over `maxMediaCacheSize`, the SDK first evicts the least recently used cached media to make room. The send is refused with reason `byteOverflow` and code `ERROR_OUTBOX_BYTE_OVERFLOW` only if the file still cannot fit, that is, when it is larger than the whole `maxMediaCacheSize` budget. +A count-based refusal or eviction is reported with code `ERROR_OUTBOX_OVERFLOW` (the exact reason is in the exception details). When a media send would push the media cache over `maxMediaCacheSize`, the SDK first evicts the least recently used cached media to make room. The send is refused with reason `byteOverflow` and code `ERROR_OUTBOX_BYTE_OVERFLOW` only if the file still cannot fit, that is, when the file (or, for a message with several files, the files together) is larger than the whole `maxMediaCacheSize` budget. A **refused** send (`queueFull` / `byteOverflow`) is never queued, so it fires **no** `onMessagePending`; it reports `onError`, and the global `OfflineMessageListener` receives `onOutboxMessageFailed(message, reason)` carrying the exact reason. diff --git a/sdk/flutter/pin-conversation.mdx b/sdk/flutter/pin-conversation.mdx index 59a0548df..cf2c7a6cb 100644 --- a/sdk/flutter/pin-conversation.mdx +++ b/sdk/flutter/pin-conversation.mdx @@ -168,7 +168,7 @@ class Class_Name with ConversationListener { -These fire for the logged-in user's own pins made on their other devices, and when a system pin is applied server-side. They do not fire on the device that made the call: update the UI for this device's own pin or unpin in the `onSuccess` callback of `pinConversation()` / `unpinConversation()`. If you use the Flutter UI Kit 6.3.0 or earlier, upgrade it to 6.4.0 with SDK 5.1.2. They never fire because another user pinned their own list. Remove the listener when you are done: +These fire for the logged-in user's own pins made on their other devices, and when a system pin is applied server-side. They do not fire on the device that made the call: update the UI for this device's own pin or unpin in the `onSuccess` callback of `pinConversation()` / `unpinConversation()`. They never fire because another user pinned their own list. If you use the Flutter UI Kit 6.3.0 or earlier, upgrade it to 6.4.0 with SDK 5.1.2. Remove the listener when you are done: