Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sdk/flutter/offline-cached-data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
| `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.
Expand All @@ -159,8 +159,8 @@

request.fetchNext(
listener: ChatUserFetchListener(),
onSuccess: null,

Check warning on line 162 in sdk/flutter/offline-cached-data.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-cached-data.mdx#L162

Did you really mean 'onSuccess'?
onError: null,

Check warning on line 163 in sdk/flutter/offline-cached-data.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-cached-data.mdx#L163

Did you really mean 'onError'?
);

class ChatUserFetchListener extends UserFetchListener {
Expand All @@ -185,7 +185,7 @@

<Note>

`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).

</Note>

Expand Down
4 changes: 2 additions & 2 deletions sdk/flutter/offline-enable.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@

```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**.

Check warning on line 43 in sdk/flutter/offline-enable.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-enable.mdx#L43

Did you really mean 'minSdk'?

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`.
</Step>
Expand All @@ -51,7 +51,7 @@
<Tabs>
<Tab title="Dart">
```dart
final offlineConfig = OfflineConfig(enabled: true);

Check warning on line 54 in sdk/flutter/offline-enable.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-enable.mdx#L54

Did you really mean 'offlineConfig'?
```
</Tab>
</Tabs>
Expand All @@ -63,7 +63,7 @@
<Tabs>
<Tab title="Dart">
```dart
AppSettings appSettings = (AppSettingsBuilder()

Check warning on line 66 in sdk/flutter/offline-enable.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-enable.mdx#L66

'appSettings' is repeated!

Check warning on line 66 in sdk/flutter/offline-enable.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-enable.mdx#L66

Did you really mean 'appSettings'?
..region = "REGION"
..setOfflineConfig(offlineConfig) // explicit config
// ..offline(true) // shorthand: enable with defaults
Expand All @@ -83,11 +83,11 @@
<Tabs>
<Tab title="Dart">
```dart
CometChat.init(appId, appSettings,

Check warning on line 86 in sdk/flutter/offline-enable.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-enable.mdx#L86

Did you really mean 'appSettings'?
onSuccess: (String message) {

Check warning on line 87 in sdk/flutter/offline-enable.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-enable.mdx#L87

Did you really mean 'onSuccess'?
debugPrint("Initialization completed successfully: $message");
},
onError: (CometChatException e) {

Check warning on line 90 in sdk/flutter/offline-enable.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-enable.mdx#L90

Did you really mean 'onError'?
debugPrint("Initialization failed: ${e.message}");
},
);
Expand All @@ -113,4 +113,4 @@

## Next steps

Offline support is now active for the logged-in user. Continue with [Show Cached Data](/sdk/flutter/offline-cached-data) to adopt the new fetch listeners, and [Send While Offline](/sdk/flutter/offline-send) for the durable outbox. Tune caps, TTLs, media, and encryption from the [Configuration & API Reference](/sdk/flutter/offline-reference).

Check warning on line 116 in sdk/flutter/offline-enable.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-enable.mdx#L116

Did you really mean 'TTLs'?
2 changes: 1 addition & 1 deletion sdk/flutter/offline-encryption.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
Offline support keeps the logged-in user's messages in a local database on the device. Turn encryption on to store that database **encrypted at rest** using [SQLite3 Multiple Ciphers](https://utelle.github.io/SQLite3MultipleCiphers/). Encryption is **opt-in** and off by default; nothing changes until you set `encryption: true`. The minimum SDK version is **5.1.0**. It works on all Flutter targets — Android, iOS, macOS, Windows, Linux and web.

<Note>
Encryption covers the **message database only**. Downloaded media files (photos, voice notes, documents) stay as ordinary unencrypted files on disk, because their local paths are handed to native image and video loaders. See [What is and isn't encrypted](#what-gets-encrypted).

Check warning on line 38 in sdk/flutter/offline-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-encryption.mdx#L38

Did you really mean 'unencrypted'?
</Note>

## Add the cipher engine
Expand Down Expand Up @@ -85,10 +85,10 @@

`encryptionFailureBehavior` decides what the cache does when encryption **cannot be applied at all** on this build or device — for example the cipher engine is not linked, or secure key storage is unavailable. It governs only that case: a transient failure still retries, and a lost or wrong key self-heals by wiping and rebuilding the cache **encrypted**.

| Value | Behavior | Writes plaintext? |

Check warning on line 88 in sdk/flutter/offline-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-encryption.mdx#L88

Did you really mean 'plaintext'?
|---|---|---|
| `onlineOnly` *(default)* | Do not open a local cache at all — the session runs server-only. Makes a setup mistake visible: offline simply does not work until the cipher engine is added. | No |
| `plaintextFallback` | Open an **unencrypted** cache so offline keeps working, and log the downgrade at error level. The status API then reports `atRest: none` and `cipherAvailable: false` so the downgrade stays visible. | Yes |

Check warning on line 91 in sdk/flutter/offline-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-encryption.mdx#L91

Did you really mean 'unencrypted'?

<Warning>
`plaintextFallback` means cached message content may be stored **unencrypted** on disk whenever encryption cannot run. This availability-over-guarantee trade is wrong for compliance use — keep the default `onlineOnly` if cached content must never be written in the clear.
Expand All @@ -100,14 +100,14 @@

| Platform | Key store |
|---|---|
| Android | Android Keystore |

Check warning on line 103 in sdk/flutter/offline-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-encryption.mdx#L103

Did you really mean 'Keystore'?
| iOS / macOS | Keychain |
| Windows | DPAPI |
| Linux | libsecret |

Check warning on line 106 in sdk/flutter/offline-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-encryption.mdx#L106

Did you really mean 'libsecret'?
| Web | WebCrypto non-extractable key |

<Note>
On all five native targets `keyStorage` reports `OfflineKeyStorage.keystore`, which names the *kind* of vault, not that hardware is involved: iOS and Android are hardware-backed, while Windows DPAPI, Linux libsecret and the macOS login keychain are OS software stores tied to the login. Web reports `OfflineKeyStorage.software`.

Check warning on line 110 in sdk/flutter/offline-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-encryption.mdx#L110

Did you really mean 'libsecret'?
</Note>

## Check encryption status
Expand Down Expand Up @@ -136,7 +136,7 @@
</Tip>

<Note>
The normative, cross-SDK wire strings behind these enums (`SQLCIPHER`, `NONE`, `KEYSTORE`, `SOFTWARE`, `ONLINE_ONLY`, `PLAINTEXT_FALLBACK`) are available through each value's `wireValue`, so an auditor gets the same answer from every CometChat SDK.

Check warning on line 139 in sdk/flutter/offline-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-encryption.mdx#L139

Did you really mean 'enums'?
</Note>

## What gets encrypted
Expand All @@ -150,7 +150,7 @@

## Cache resets on key loss

If the key can no longer decrypt the stored database, the SDK wipes the local cache and rebuilds it **encrypted** — it never silently falls back to plaintext for a cache that could be encrypted. Any unsent messages still queued in the outbox at that point are lost.

Check warning on line 153 in sdk/flutter/offline-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-encryption.mdx#L153

Did you really mean 'plaintext'?

How they are reported depends on the reason. When the reset is `encryptionChanged` (you turned encryption on or off between launches), each queued message fails with reason `discarded` and `pendingMessagesLost` is the exact count. For a key or corruption reset, the queued rows lived inside the unreadable database, so they cannot be counted one by one: they are lost silently and `pendingMessagesLost` is `null`. **`null` is not zero** — it means an unknown number were lost.

Expand All @@ -168,4 +168,4 @@
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.
2 changes: 1 addition & 1 deletion sdk/flutter/offline-media-caching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

</Accordion>

With offline support on, the SDK can cache attachment bytes durably on the device so media stays viewable offline — even after the server's presigned URL has expired. This page covers the caching modes, what downloads automatically, how to read cached bytes, and how to download media on demand.

Check warning on line 41 in sdk/flutter/offline-media-caching.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-media-caching.mdx#L41

Did you really mean 'presigned'?

<Note>

Expand Down Expand Up @@ -71,7 +71,7 @@

In `auto` mode, media bytes are downloaded and cached automatically on the two live receive paths:

- a **realtime** media message received while connected, and

Check warning on line 74 in sdk/flutter/offline-media-caching.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-media-caching.mdx#L74

Did you really mean 'realtime'?
- opening a chat **online** (the server read refreshes and caches its media).

A media message that arrives through a reconnect catch-up [sync](/sdk/flutter/offline-sync) is cached as **metadata only** and renders as a placeholder; its bytes download lazily the next time you open that chat online. This holds in both `auto` and `off`.
Expand Down Expand Up @@ -131,7 +131,7 @@
|---|---|
| `offlineNotCached` | The device is offline and the bytes are not cached — expected, not a bug. |
| `noUrl` | The attachment carries no usable URL. |
| `resignFailed` | The presigned URL expired and could not be re-signed. |

Check warning on line 134 in sdk/flutter/offline-media-caching.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-media-caching.mdx#L134

Did you really mean 'presigned'?
| `downloadFailed` | The bytes could not be fetched or written. |
| `unavailable` | Offline support (or its media store) is not active. |

Expand Down Expand Up @@ -159,6 +159,6 @@

## 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 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<int>` of the total local bytes held) and the configured limits. See the [configuration reference](/sdk/flutter/offline-reference) for the full set of options.
6 changes: 4 additions & 2 deletions sdk/flutter/offline-reference.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Offline Configuration & API Reference"
sidebarTitle: "Configuration & API Reference"
description: "A complete reference for the offline configuration options, public methods, listeners, enums, model fields, and error codes with the CometChat Flutter SDK."

Check warning on line 4 in sdk/flutter/offline-reference.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-reference.mdx#L4

Did you really mean 'enums'?
---

{/* TL;DR for Agents and Quick Reference */}
Expand Down Expand Up @@ -32,7 +32,7 @@

</Accordion>

This page is the full surface of CometChat's offline support on Flutter: configuration options, public methods, listeners, enums, model fields, and error codes. The minimum SDK version is **5.1.0**, and offline support is **off by default**. For task-focused guides see [Enable Offline Support](/sdk/flutter/offline-enable), [Show Cached Data](/sdk/flutter/offline-cached-data), [Send While Offline](/sdk/flutter/offline-send), [Stay in Sync](/sdk/flutter/offline-sync), [Media Caching](/sdk/flutter/offline-media-caching), and [Encrypt the Cache](/sdk/flutter/offline-encryption).

Check warning on line 35 in sdk/flutter/offline-reference.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-reference.mdx#L35

Did you really mean 'enums'?

## OfflineConfig options

Expand Down Expand Up @@ -68,7 +68,7 @@
| `retryMessage(String localMessageId, {required MessageSentListener listener})` | `Future<void>` | Retry one failed message by its local id; the outcome arrives on `listener`. |
| `retryAllFailedMessages()` | `Future<void>` | Retry every failed message in the outbox; outcomes arrive on the registered `OfflineMessageListener`. |
| `discardLocalMessage(String localMessageId, {required onSuccess, required onError})` | `Future<void>` | Remove one unsent message from the outbox. |
| `forceSyncNow({ForceSyncListener? callback})` | `Future<void>` | Request a catch-up sync. Silently dropped if a sync is already running or one ran within the cooldown window, and a no-op when offline is not active. Pass `callback` to learn why a sync did not start. |

Check warning on line 71 in sdk/flutter/offline-reference.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-reference.mdx#L71

Did you really mean 'cooldown'?
| `getSyncState()` | `SyncState` | Whether a catch-up sweep is currently running. |
| `getLastSyncTimestamp()` | `Future<int?>` | Device-clock time of the last successful sync, in epoch milliseconds; `null` if the cache has never synced. |
| `clearOfflineCache()` | `Future<void>` | Wipe the local cache (and fail any unsent messages). |
Expand Down Expand Up @@ -123,19 +123,19 @@
| `MediaDownloadListener` | `onMediaDownloaded(String? messageLocalId, String attachmentId, String localPath)`, `onMediaDownloadFailed(String? messageLocalId, String attachmentId, MediaException)` |
| `MessageListener` | `onMessagesSynced(List<BaseMessage>)` (offline addition to the existing listener) |

## Enums

Check warning on line 126 in sdk/flutter/offline-reference.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-reference.mdx#L126

Did you really mean 'Enums'?

| Enum | Values |
|---|---|
| `MediaCachingMode` | `auto` (auto-download + retain received media), `off` (skip auto-download; metadata still cached) |
| `MediaErrorCode` | `offlineNotCached`, `noUrl`, `resignFailed`, `downloadFailed`, `unavailable` |
| `PendingMessageOverflowPolicy` | `dropOldest` (evict the oldest pending to admit a newer send), `rejectNewest` (reject the new send) |
| `EncryptionFailureBehavior` | `onlineOnly` (server-only; never plaintext), `plaintextFallback` (open an unencrypted cache) |

Check warning on line 133 in sdk/flutter/offline-reference.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-reference.mdx#L133

Did you really mean 'plaintext'?

Check warning on line 133 in sdk/flutter/offline-reference.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-reference.mdx#L133

Did you really mean 'unencrypted'?
| `CometChatMessageStatus` | `pending`, `sending`, `sent`, `delivered`, `read`, `failed` |
| `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` |
Expand All @@ -146,7 +146,7 @@

| Field | Type | Meaning |
|---|---|---|
| `BaseMessage.localMessageId` | `String?` | SDK-generated local handle for an optimistic/offline send; the stable key to reconcile the row when the server ack arrives. `null` for messages that never went through the outbox. |

Check warning on line 149 in sdk/flutter/offline-reference.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-reference.mdx#L149

Did you really mean 'ack'?
| `BaseMessage.status` | `CometChatMessageStatus` | Lifecycle status of the message. |
| `BaseMessage.failureReason` | `MessageFailureReason?` | Why the message failed; non-`null` only while `status` is `failed`, otherwise `null`. |
| `Attachment.localPath` | `String?` | Absolute device path to cached media bytes, or `null` when not cached. Never sent to the server. |
Expand All @@ -159,7 +159,7 @@
|---|---|
| `ERR_CONNECTION` | A read reached the server phase with no connection (fires after the cached page on a two-phase fetch; the details carry `ERROR_INTERNET_UNAVAILABLE`). On a send made with a `listener:`, it means the message was queued — `onMessageSent` will still fire once the connection returns. On an upload, it means the transfer hit a network error. |
| `ERROR_OFFLINE_SYNC_IN_PROGRESS` | `forceSyncNow(callback: …)` was called while a sync is already running (`OfflineSyncError.inProgress`). |
| `ERROR_OFFLINE_SYNC_COOLDOWN` | `forceSyncNow(callback: …)` was called within the throttle cooldown (`OfflineSyncError.cooldown`). |

Check warning on line 162 in sdk/flutter/offline-reference.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-reference.mdx#L162

Did you really mean 'cooldown'?
| `ERROR_OFFLINE_DISABLED` | An offline-only operation was called while offline support is not active (`OfflineSyncError.disabled`). |
| `ERROR_OFFLINE_MESSAGE_DISCARDED` | A queued message was removed before it could send (`OfflineSendError.discarded`). |
| `ERROR_OFFLINE_MESSAGE_IN_FLIGHT` | `retryMessage` / `discardLocalMessage` targeted a message that is still being sent (`OfflineSendError.inFlight`). |
Expand All @@ -172,6 +172,8 @@
| `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
Expand All @@ -188,7 +190,7 @@
| `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` |
Expand Down
4 changes: 2 additions & 2 deletions sdk/flutter/offline-send.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@
}
}

final textMessage = TextMessage(

Check warning on line 88 in sdk/flutter/offline-send.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-send.mdx#L88

Did you really mean 'textMessage'?
text: "Hello!",
receiverUid: "UID",

Check warning on line 90 in sdk/flutter/offline-send.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-send.mdx#L90

Did you really mean 'receiverUid'?
receiverType: CometChatConversationType.user,

Check warning on line 91 in sdk/flutter/offline-send.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-send.mdx#L91

Did you really mean 'receiverType'?
type: CometChatMessageType.text,
);

Expand Down Expand Up @@ -185,7 +185,7 @@
| `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 (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
Expand Down Expand Up @@ -274,7 +274,7 @@

## Auto-send on Reconnect

By default, queued `pending` messages are sent automatically when the realtime connection is re-established. This is controlled by `OfflineConfig.autoSendPendingOnReconnect` (default `true`); see [Enable Offline Support](/sdk/flutter/offline-enable) and the [reference](/sdk/flutter/offline-reference). A queued message that keeps getting no answer is retried on each reconnect, up to 5 times, then becomes `failed` (`transient`). With it off, nothing retries a queued message on reconnect — a send that gets no answer becomes `failed` (`transient`), which you recover with `retryMessage`.

Check warning on line 277 in sdk/flutter/offline-send.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-send.mdx#L277

Did you really mean 'realtime'?

Reconnect also runs a catch-up sync for received messages — see [Stay in Sync](/sdk/flutter/offline-sync).

Expand All @@ -287,7 +287,7 @@
| `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 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.

Expand Down Expand Up @@ -331,6 +331,6 @@

<Tip>

For the full list of offline methods, listeners, enums, model fields, and error codes, see the [Offline Configuration & API Reference](/sdk/flutter/offline-reference).

Check warning on line 334 in sdk/flutter/offline-send.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-send.mdx#L334

Did you really mean 'enums'?

</Tip>
5 changes: 4 additions & 1 deletion sdk/flutter/offline-sync.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
<Tab title="Dart">
```dart
final SyncState state = CometChat.getSyncState(); // SyncState.idle or SyncState.syncing
final int? lastSync = await CometChat.getLastSyncTimestamp(); // device epoch ms; null if never synced

Check warning on line 170 in sdk/flutter/offline-sync.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/offline-sync.mdx#L170

Did you really mean 'lastSync'?
```

</Tab>
Expand Down Expand Up @@ -213,7 +213,7 @@

## 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.

<Tabs>
<Tab title="Dart">
Expand All @@ -239,6 +239,9 @@
| `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.

Expand Down
4 changes: 2 additions & 2 deletions sdk/flutter/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<Info>
**Faster Integration with UI Kits**
Expand All @@ -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.
</Warning>

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
Expand Down
2 changes: 1 addition & 1 deletion sdk/flutter/pin-conversation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
<Tabs>
<Tab title="Dart">
```dart
String conversationWith = "cometchat-uid-1";

Check warning on line 43 in sdk/flutter/pin-conversation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-conversation.mdx#L43

Did you really mean 'conversationWith'?
String conversationType = CometChatConversationType.user;

Check warning on line 44 in sdk/flutter/pin-conversation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-conversation.mdx#L44

Did you really mean 'conversationType'?

CometChat.pinConversation(conversationWith, conversationType,

Check warning on line 46 in sdk/flutter/pin-conversation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-conversation.mdx#L46

Did you really mean 'conversationType'?
onSuccess: (Conversation conversation) {

Check warning on line 47 in sdk/flutter/pin-conversation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-conversation.mdx#L47

Did you really mean 'onSuccess'?
debugPrint("Conversation pinned at: ${conversation.pinnedAt}");
}, onError: (CometChatException e) {

Check warning on line 49 in sdk/flutter/pin-conversation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-conversation.mdx#L49

Did you really mean 'onError'?
debugPrint("Conversation pinning failed with exception: ${e.message}");
});
```
Expand Down Expand Up @@ -90,7 +90,7 @@
<Tabs>
<Tab title="Dart">
```dart
class Class_Name extends ConversationFetchListener {

Check warning on line 93 in sdk/flutter/pin-conversation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-conversation.mdx#L93

Did you really mean 'Class_Name'?
@override
void onCachedConversations(List<Conversation> conversations) {
// Render the cached pinned list immediately (even when empty).
Expand All @@ -109,7 +109,7 @@
}
}

ConversationsRequest conversationsRequest = (ConversationsRequestBuilder()

Check warning on line 112 in sdk/flutter/pin-conversation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-conversation.mdx#L112

'conversationsRequest' is repeated!

Check warning on line 112 in sdk/flutter/pin-conversation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-conversation.mdx#L112

Did you really mean 'conversationsRequest'?
..limit = 30)
.build();

Expand Down Expand Up @@ -149,7 +149,7 @@
<Tabs>
<Tab title="Dart">
```dart
class Class_Name with ConversationListener {

Check warning on line 152 in sdk/flutter/pin-conversation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-conversation.mdx#L152

Did you really mean 'Class_Name'?

//CometChat.addConversationListener("listenerId", this);

Expand All @@ -168,7 +168,7 @@
</Tab>
</Tabs>

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()`. 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:

<Tabs>
<Tab title="Dart">
Expand Down Expand Up @@ -206,15 +206,15 @@
| `ERR_UID_NOT_FOUND` / `ERR_GUID_NOT_FOUND` | The peer named by `conversationWith` does not exist. |
| `ERR_SYSTEM_PINNED_CONVERSATION` | The conversation is **system-pinned**, which a user may never unpin. |

Pins are per-user, so pinning a conversation never affects anyone else's list. Both calls are idempotent: unpinning a conversation that was never pinned succeeds rather than erroring.

Check warning on line 209 in sdk/flutter/pin-conversation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-conversation.mdx#L209

Did you really mean 'else's'?

Check warning on line 209 in sdk/flutter/pin-conversation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-conversation.mdx#L209

Did you really mean 'erroring'?

<Tabs>
<Tab title="Dart">
```dart
CometChat.pinConversation(conversationWith, conversationType,

Check warning on line 214 in sdk/flutter/pin-conversation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-conversation.mdx#L214

Did you really mean 'conversationType'?
onSuccess: (Conversation conversation) {

Check warning on line 215 in sdk/flutter/pin-conversation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-conversation.mdx#L215

Did you really mean 'onSuccess'?
debugPrint("Conversation pinned");
}, onError: (CometChatException e) {

Check warning on line 217 in sdk/flutter/pin-conversation.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-conversation.mdx#L217

Did you really mean 'onError'?
if (e.code == 'ERR_PINNED_CONVERSATIONS_LIMIT_EXCEEDED') {
final limit = e.errorParams?['limit'];
debugPrint("You can only pin $limit conversations.");
Expand Down
2 changes: 1 addition & 1 deletion sdk/flutter/pin-message.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
<Tabs>
<Tab title="Dart">
```dart
int messageId = 103;

Check warning on line 43 in sdk/flutter/pin-message.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-message.mdx#L43

Did you really mean 'messageId'?

CometChat.pinMessage(messageId, onSuccess: (BaseMessage message) {

Check warning on line 45 in sdk/flutter/pin-message.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-message.mdx#L45

Did you really mean 'onSuccess'?
debugPrint("Message pinned at: ${message.pinnedAt}");
}, onError: (CometChatException e) {

Check warning on line 47 in sdk/flutter/pin-message.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-message.mdx#L47

Did you really mean 'onError'?
debugPrint("Message pinning failed with exception: ${e.message}");
});
```
Expand Down Expand Up @@ -88,7 +88,7 @@
<Tabs>
<Tab title="Dart (User)">
```dart
MessagesRequest messageRequest = (MessagesRequestBuilder()

Check warning on line 91 in sdk/flutter/pin-message.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-message.mdx#L91

Did you really mean 'messageRequest'?
..uid = "cometchat-uid-1"
..pinned = true
..limit = 50)
Expand All @@ -96,7 +96,7 @@

messageRequest.fetchPrevious(onSuccess: (List<BaseMessage> list) {
debugPrint("Pinned messages fetched: ${list.length}");
}, onError: (CometChatException e) {

Check warning on line 99 in sdk/flutter/pin-message.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-message.mdx#L99

Did you really mean 'onError'?
debugPrint("Pinned message fetching failed with exception: ${e.message}");
});
```
Expand Down Expand Up @@ -153,7 +153,7 @@
<Tabs>
<Tab title="Dart">
```dart
class Class_Name with MessageListener {

Check warning on line 156 in sdk/flutter/pin-message.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-message.mdx#L156

Did you really mean 'Class_Name'?

//CometChat.addMessageListener("listenerId", this);

Expand All @@ -172,7 +172,7 @@
</Tab>
</Tabs>

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

Expand Down Expand Up @@ -209,9 +209,9 @@
<Tabs>
<Tab title="Dart">
```dart
CometChat.pinMessage(messageId, onSuccess: (BaseMessage message) {

Check warning on line 212 in sdk/flutter/pin-message.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-message.mdx#L212

Did you really mean 'onSuccess'?
debugPrint("Message pinned");
}, onError: (CometChatException e) {

Check warning on line 214 in sdk/flutter/pin-message.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/pin-message.mdx#L214

Did you really mean 'onError'?
if (e.code == 'ERR_PINNED_MESSAGES_LIMIT_EXCEEDED') {
final limit = e.errorParams?['limit'];
debugPrint("You can only pin $limit messages. Unpin one to pin another.");
Expand Down
4 changes: 2 additions & 2 deletions sdk/flutter/reactions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
<Tabs>
<Tab title="Dart">
```dart
int messageId = 1;

Check warning on line 35 in sdk/flutter/reactions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/reactions.mdx#L35

Did you really mean 'messageId'?

CometChat.addReaction(messageId, "😴", onSuccess: (message) {

Check warning on line 37 in sdk/flutter/reactions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/reactions.mdx#L37

Did you really mean 'onSuccess'?
debugPrint("Success : ${message.reactions.last.reaction}");
}, onError: (e) {

Check warning on line 39 in sdk/flutter/reactions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/reactions.mdx#L39

Did you really mean 'onError'?
debugPrint("Error: ${e.message}");
});
```
Expand Down Expand Up @@ -89,17 +89,17 @@
<Tabs>
<Tab title="Dart">
```dart
int messageId = 1;

Check warning on line 92 in sdk/flutter/reactions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/reactions.mdx#L92

Did you really mean 'messageId'?

ReactionsRequest reactionRequest = (ReactionsRequestBuilder()..limit = 30..messageId = messageId).build();

Check warning on line 94 in sdk/flutter/reactions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/reactions.mdx#L94

Did you really mean 'reactionRequest'?

reactionRequest.fetchNext(
onSuccess: (messageReactions) {

Check warning on line 97 in sdk/flutter/reactions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/reactions.mdx#L97

Did you really mean 'onSuccess'?

Check warning on line 97 in sdk/flutter/reactions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/reactions.mdx#L97

Did you really mean 'messageReactions'?
for (Reaction reaction in messageReactions) {
debugPrint("Success: ${reaction.reaction} by ${reaction.uid}");
}
},
onError: (e) {

Check warning on line 102 in sdk/flutter/reactions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/reactions.mdx#L102

Did you really mean 'onError'?
debugPrint("Error: ${e.message}");
},
);
Expand All @@ -109,7 +109,7 @@
</Tabs>

## 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).

<Tabs>
<Tab title="Dart">
Expand Down Expand Up @@ -149,8 +149,8 @@
}

@override
void onMessageReactionAdded(ReactionEvent reactionEvent) {

Check warning on line 152 in sdk/flutter/reactions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/reactions.mdx#L152

Did you really mean 'reactionEvent'?
debugPrint("Reaction added ${reactionEvent.reaction}");

Check warning on line 153 in sdk/flutter/reactions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/reactions.mdx#L153

Did you really mean 'reactionEvent'?
}

@override
Expand Down Expand Up @@ -198,7 +198,7 @@
<Tabs>
<Tab title="Dart">
```dart
for (ReactionCount reactionCount in message.reactions) {

Check warning on line 201 in sdk/flutter/reactions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/reactions.mdx#L201

Did you really mean 'reactionCount'?
debugPrint("isReactedByMe ${reactionCount.reactedByMe}"); //Return true is logged-in user reacted on that message, otherwise false
}
```
Expand All @@ -220,14 +220,14 @@
BaseMessage message = ...;

// The reaction event data received in real-time
Reaction messageReaction = ...;

Check warning on line 223 in sdk/flutter/reactions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/reactions.mdx#L223

Did you really mean 'messageReaction'?

// The recieved reaction event real-time action type. Can be CometChatConstants.REACTION_ADDED or CometChatConstants.REACTION_REMOVED

Check warning on line 225 in sdk/flutter/reactions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/reactions.mdx#L225

Did you really mean 'recieved'?
var action = CometChatConstants.REACTION_ADDED;

BaseMessage modifiedBaseMessage = await CometChatHelper.updateMessageWithReactionInfo(
baseMessage,

Check warning on line 229 in sdk/flutter/reactions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/reactions.mdx#L229

Did you really mean 'baseMessage'?
messageReaction,

Check warning on line 230 in sdk/flutter/reactions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (cometchat-22654f5b) - vale-spellcheck

sdk/flutter/reactions.mdx#L230

Did you really mean 'messageReaction'?
action
);
```
Expand All @@ -237,7 +237,7 @@

## 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 |
|---|---|
Expand Down
Loading