Skip to main content
This guide builds a single chat window — no conversation list. Users go directly into a one-to-one or group chat. Good for support chat, deep links, or focused messaging. This assumes you’ve already completed Getting Started (project created, UI Kit installed, init + login working).
View Sample App on GitHub

What You’re Building

Three components stacked vertically:
  1. Chat header — displays recipient name, avatar, and call buttons
  2. Message list — real-time chat history
  3. Message composer — text input with media and emojis

Step 1 — Create the Chat Screen

The app fetches a user on mount and renders the message components.
lib/chat_screen.dart
Key points:
  • CometChat.getUser(uid) fetches the user object — you need a real user object, not a manually constructed one.
  • Pass either user or group to the message components, never both.

Switching to Group Chat

To load a group chat instead, use CometChat.getGroup():

Step 2 — Run the App

You should see the chat window load with the conversation for the UID you set.

Next Steps

Message List

Customize the message view

Conversations

Add a conversation list

Theming

Customize colors and styles

Events

Handle real-time events