cometchat-flutter-v5-conversations

$npx mdskill add cometchat/cometchat-skills/cometchat-flutter-v5-conversations

Displays a list of recent conversations for user interaction

  • Identifies and fetches recent conversations from CometChat server.
  • Depends on CometChat Flutter UIKit v5 package for UI rendering and CometChat SDK for communication.
  • Decides what to display based on fetched conversation data, including sender details and message count.
  • Delivers the list of conversations to the user interface via callbacks for tap and long press actions.

SKILL.md

.github/skills/cometchat-flutter-v5-conversationsView on GitHub ↗
---
name: cometchat-flutter-v5-conversations
description: "Use when working with CometChat Flutter UIKit v5 conversation list component. Triggers on CometChatConversations, conversation list, recent chats."
license: "MIT"
compatibility: "cometchat_chat_uikit ^5.2.14; cometchat_uikit_shared ^5.2.3"
metadata:
  author: "CometChat"
  version: "3.0.0"
  tags: "cometchat flutter v5 conversations list recent chats"
---

> **Ground truth:** `cometchat_chat_uikit: ^5.2` (legacy/maintenance-only; calls via raw `cometchat_calls_sdk ^5.0.2`) — pub-cache source + `ui-kit/flutter/v5`. **Official docs:** https://www.cometchat.com/docs/ui-kit/flutter/v5/overview · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly without MCP). Verify symbols against the installed package/source before relying on them.

# CometChat Flutter UIKit v5 — Conversations

The `CometChatConversations` component displays a list of recent conversations.

## Key Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `conversationsRequestBuilder` | `ConversationsRequestBuilder?` | — | Custom fetch builder |
| `conversationsStyle` | `CometChatConversationsStyle` | `const CometChatConversationsStyle()` | Visual styling |
| `onItemTap` | `Function(Conversation)?` | — | Tap callback (**no BuildContext**) |
| `onItemLongPress` | `Function(Conversation)?` | — | Long press callback |
| `subtitleView` | `Widget? Function(BuildContext, Conversation)?` | — | Custom subtitle |
| `listItemView` | `Widget Function(Conversation)?` | — | Custom list item (replaces the whole row) |
| `leadingView` | `Widget? Function(BuildContext, Conversation)?` | — | Custom leading widget (avatar slot) |
| `titleView` | `Widget? Function(BuildContext, Conversation)?` | — | Custom title widget |
| `trailingView` | `Widget? Function(Conversation)?` | — | Custom trailing widget (single-arg — asymmetric with the other slots) |
| `title` | `String?` | — | List title |
| `showBackButton` | `bool` | `false` | Show back button |
| `onBack` | `VoidCallback?` | — | Back button callback |
| `hideAppbar` | `bool?` | `false` | Hide app bar |
| `appBarOptions` | `List<Widget>?` | — | App bar trailing widgets |
| `usersStatusVisibility` | `bool?` | `true` | Show online status |
| `receiptsVisibility` | `bool?` | `true` | Show read receipts |
| `textFormatters` | `List<CometChatTextFormatter>?` | — | Text formatters for subtitles |
| `controllerTag` | `String?` | — | Custom GetX controller tag |
| `hideSearch` | `bool?` | — | Hide search bar |
| `searchReadOnly` | `bool` | `false` | Read-only search |
| `onSearchTap` | `GestureTapCallback?` | — | Search tap callback |
| `deleteConversationOptionVisibility` | `bool?` | `true` | Show delete option |
| `loadingStateView` | `WidgetBuilder?` | — | Custom loading state |
| `emptyStateView` | `WidgetBuilder?` | — | Custom empty state |
| `errorStateView` | `WidgetBuilder?` | — | Custom error state |
| `setOptions` | `Function?` | — | Replace long-press options |
| `addOptions` | `Function?` | — | Add to long-press options |

## Basic Usage

```dart
CometChatConversations(
  onItemTap: (conversation) {
    User? user;
    Group? group;
    if (conversation.conversationWith is User) {
      user = conversation.conversationWith as User;
    } else {
      group = conversation.conversationWith as Group;
    }
    Navigator.push(context, MaterialPageRoute(
      builder: (_) => MessagesScreen(user: user, group: group),
    ));
  },
)
```

## Custom Request Builder

```dart
CometChatConversations(
  conversationsRequestBuilder: ConversationsRequestBuilder()
    ..limit = 30
    ..conversationType = ConversationType.user,
)
```

## Internal Architecture (GetX)

The component creates `CometChatConversationsController` via `Get.put()` in `initState()` and deletes it in `dispose()` (unless `controllerTag` is provided externally).

Theme values are cached in `didChangeDependencies()` (unconditionally, no flag):
```dart
@override
void didChangeDependencies() {
  typography = CometChatThemeHelper.getTypography(context);
  colorPalette = CometChatThemeHelper.getColorPalette(context);
  spacing = CometChatThemeHelper.getSpacing(context);
  style = CometChatThemeHelper.getTheme<CometChatConversationsStyle>(
      context: context, defaultTheme: CometChatConversationsStyle.of)
    .merge(widget.conversationsStyle);
  super.didChangeDependencies();
}
```

## Anti-Patterns

```dart
// ❌ WRONG — trying to access controller before component mounts
final controller = Get.find<CometChatConversationsController>();

// ❌ WRONG — manually creating controller outside the widget
Get.put(CometChatConversationsController(...));

// ❌ WRONG — not extracting User/Group from conversation
onItemTap: (conversation) {
  Navigator.push(context, MaterialPageRoute(
    builder: (_) => MessagesScreen(user: conversation.conversationWith), // Type error
  ));
}
```

## Checklist — Conversations

- [ ] `onItemTap` extracts `User`/`Group` from `conversation.conversationWith` with type check
- [ ] Navigation to messages screen passes extracted `user` or `group`
- [ ] Let the widget manage its own GetX controller lifecycle

More from cometchat/cometchat-skills

SkillDescription
cometchatEntry-point for CometChat integration in any React, React Native, Angular, Android, Flutter, or iOS project — web (React/Next.js/React Router/Astro), React Native (Expo/bare), Angular (12-15), native Android (V6 stable, V5 legacy), Flutter (V6 stable, V5 legacy), and native iOS (V5 stable). Detects the framework, gathers requirements through an interactive conversation, and writes production-quality integration code.
cometchat-a11yAccessibility (a11y) for CometChat UI Kit integrations across all families — React, React Native, Angular, Android (V5/V6), iOS, Flutter. Covers WCAG 2.1 AA targets, keyboard navigation in chat, screen reader announcements (live regions for new messages), color contrast, focus management on call screens, motion-reduction support, and the cross-family checks that catch the common production a11y bugs. Cross-family — applies wherever the agent is checking accessibility.
cometchat-android-v5Entry-point dispatcher for CometChat Android UI Kit v5. Detects project setup, understands what the dev is building, and routes to the right sub-skills.
cometchat-android-v5-callsCometChat Calls SDK v5 integration for native Android (V5 stable, Java + Kotlin Views). Covers SDK setup (Cloudsmith Maven, CallAppSettings, init), the dual-SDK ringing pattern (Chat SDK initiateCall + Calls SDK joinSession), session settings, event listeners, call logs, recording, screen sharing, picture-in-picture, foreground service for ongoing calls, VoIP push via FCM + ConnectionService, audio/video/participant controls, custom UI, and in-call chat. Use in standalone mode (calls is the product) or additive mode (calls layered on top of an existing CometChat Android v5 chat integration).
cometchat-android-v5-componentsComplete catalog of CometChat Android UI Kit v5 components. Reference before writing integration code — never invent component names.
cometchat-android-v5-coreFoundational rules for CometChat Android UI Kit v5. Initialization, login, UIKitSettings builder, dependency setup, and anti-patterns. Read this first.
cometchat-android-v5-customizationCustomize CometChat components beyond theming — custom message templates, DataSource decorators, event listeners, and custom view slots.
cometchat-android-v5-extensionsExtension architecture for CometChat Android — ExtensionsDataSource, decorators, built-in extensions, and how to create custom extensions.
cometchat-android-v5-featuresAdd features (calls, reactions, polls, file sharing, AI, etc.) to an already-integrated CometChat project. Routes to the right sub-flow based on feature type.
cometchat-android-v5-placementWhere to put CometChat in your Android app — Activity, Fragment, BottomSheet, Dialog, Tab, or embedded patterns.