cometchat-flutter-v5-users-groups

$npx mdskill add cometchat/cometchat-skills/cometchat-flutter-v5-users-groups

Manage CometChat Flutter v5 user and group list components.

  • Displays and manages users, groups, and group members lists.
  • Depends on cometchat_chat_uikit ^5.2.14 and cometchat_uikit_shared ^5.2.3.
  • Triggers on CometChatUsers, CometChatGroups, CometChatGroupMembers, CometChatChangeScope.
  • Provides customizable UI components with tap and long-press callbacks.

SKILL.md

.github/skills/cometchat-flutter-v5-users-groupsView on GitHub ↗
---
name: cometchat-flutter-v5-users-groups
description: "Use when working with CometChat Flutter UIKit v5 user and group list components. Triggers on CometChatUsers, CometChatGroups, CometChatGroupMembers, CometChatChangeScope."
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 users groups members scope contacts"
---

> **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 — Users & Groups

Components for displaying and managing users, groups, and group members.

## CometChatUsers

Displays a list of users, sorted alphabetically.

### Key Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `usersRequestBuilder` | `UsersRequestBuilder?` | — | Custom fetch builder |
| `usersStyle` | `CometChatUsersStyle` | `const CometChatUsersStyle()` | Visual styling |
| `onItemTap` | `Function(BuildContext, User)?` | — | Tap callback (**includes BuildContext**) |
| `onItemLongPress` | `Function(BuildContext, User)?` | — | Long press callback |
| `subtitleView` | `Widget? Function(BuildContext, User)?` | — | Custom subtitle |
| `title` | `String?` | — | List title |
| `showBackButton` | `bool` | `true` | Show back button |
| `hideSearch` | `bool` | `false` | Hide search bar |
| `selectionMode` | `SelectionMode?` | — | Enable selection mode |
| `onSelection` | `Function(List<User>?, BuildContext)?` | — | Selection callback |
| `usersStatusVisibility` | `bool?` | `true` | Show online status |
| `hideAppbar` | `bool?` | `false` | Hide app bar |
| `appBarOptions` | `List<Widget> Function(BuildContext)?` | — | App bar trailing widgets |
| `controllerTag` | `String?` | — | Custom GetX controller tag |
| `stickyHeaderVisibility` | `bool?` | `false` | Show alphabetical headers |

### Usage

```dart
CometChatUsers(
  onItemTap: (context, user) {
    Navigator.push(context, MaterialPageRoute(
      builder: (_) => MessagesScreen(user: user),
    ));
  },
)

// With custom request builder
CometChatUsers(
  usersRequestBuilder: UsersRequestBuilder()
    ..limit = 30
    ..friendsOnly = true,
)

// Filter by role (e.g., AI agents)
CometChatUsers(
  title: "Agents",
  usersRequestBuilder: UsersRequestBuilder()
    ..roles = [AIConstants.aiRole],
  onItemTap: (context, user) { ... },
)
```

## CometChatGroups

Displays a list of groups with type indicators.

### Key Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `groupsRequestBuilder` | `GroupsRequestBuilder?` | — | Custom fetch builder |
| `groupsStyle` | `CometChatGroupsStyle?` | — | Visual styling |
| `onItemTap` | `Function(BuildContext, Group)?` | — | Tap callback (**includes BuildContext**) |
| `onItemLongPress` | `Function(BuildContext, Group)?` | — | Long press callback |
| `subtitleView` | `Widget? Function(BuildContext, Group)?` | — | Custom subtitle |
| `title` | `String?` | — | List title |
| `showBackButton` | `bool` | `true` | Show back button |
| `hideSearch` | `bool` | `false` | Hide search bar |
| `selectionMode` | `SelectionMode?` | — | Enable selection mode |
| `groupTypeVisibility` | `bool` | `true` | Show group type icon |
| `hideAppbar` | `bool?` | `false` | Hide app bar |
| `appBarOptions` | `List<Widget> Function(BuildContext)?` | — | App bar trailing widgets |
| `controllerTag` | `String?` | — | Custom GetX controller tag |

### Usage

```dart
CometChatGroups(
  onItemTap: (context, group) {
    Navigator.push(context, MaterialPageRoute(
      builder: (_) => MessagesScreen(group: group),
    ));
  },
)
```

## CometChatGroupMembers

Displays members of a specific group with role indicators.

```dart
CometChatGroupMembers(
  group: group,
  onItemTap: (member) {
    debugPrint('Tapped: ${member.name}, role: ${member.scope}');
  },
)
```

Key props: `group` (required), `groupMembersRequestBuilder`, **`style`** (`CometChatGroupMembersStyle?` — prop name is `style`, NOT `groupMembersStyle`; verified `cometchat_group_members.dart:25/88`), `subtitleView`, `trailingView`, `onItemTap` (`Function(GroupMember)?` — **no BuildContext**), `selectionMode`, `onSelection` (`Function(List<GroupMember>?)?` — no BuildContext).

## CometChatChangeScope

Widget for changing a group member's scope/role.

```dart
CometChatChangeScope(group: group, member: member)
```

## Callback Signature Differences

| Component | `onItemTap` signature |
|-----------|----------------------|
| `CometChatConversations` | `Function(Conversation)?` — **no BuildContext** |
| `CometChatUsers` | `Function(BuildContext, User)?` — **has BuildContext** |
| `CometChatGroups` | `Function(BuildContext, Group)?` — **has BuildContext** |
| `CometChatGroupMembers` | `Function(GroupMember)?` — **no BuildContext** |

This is a common source of confusion.

## Anti-Patterns

```dart
// ❌ WRONG — missing BuildContext in Users/Groups onItemTap
CometChatUsers(onItemTap: (user) { ... }) // Missing BuildContext!

// ✅ CORRECT
CometChatUsers(onItemTap: (context, user) { ... })
CometChatGroups(onItemTap: (context, group) { ... })
```

## Checklist — Users & Groups

- [ ] `onItemTap` callback signature includes `BuildContext` for Users/Groups
- [ ] Custom request builders set appropriate limits
- [ ] Let widgets manage their 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.