What It Demonstrates
This example shows:- ✅ SDK initialization
- ✅ WebSocket connection
- ✅ Event handling
- ✅ Sending text messages
- ✅ Receiving text responses
- ✅ Custom UI implementation
Prerequisites
- Flutter SDK 3.0.0 or higher
- Kuralit Flutter SDK installed
- A running AI Voice Agent server (see Quickstart)
Step-by-Step Explanation
Step 1: Initialize SDK
Step 2: Generate Session ID
Step 3: Set Up Event Listener
Step 4: Connect to Server
Step 5: Send Messages
Full Code Structure
The example includes:- SDK Initialization - Configure and initialize SDK
- Event Handling - Listen to all SDK events
- Connection Management - Connect/disconnect handling
- Message Sending - Send text messages
- Message Display - Show messages in UI
- Connection Status - Visual connection indicator
How to Run
Step 1: Update Configuration
Editmain.dart and update:
Step 2: Run the App
Expected Behavior
- App starts - SDK initializes
- Connects to server - WebSocket connection established
- Connection indicator - Shows green “Connected” status
- Send message - Type and send a message
- Receive response - Agent response appears in chat
Key Features
- Text messaging - Send and receive text messages
- Connection status - Visual indicator in app bar
- Message history - View all messages in conversation
- Error handling - Shows errors in UI
- Streaming support - Handles partial/streaming responses
Code Highlights
Event Handling
Message Sending
Next Steps
- Popup Chat → - Use ready-made template
- Agent Overlay → - Voice-first overlay
- Protocol Demo → - Understand the protocol
Related
- Basic Usage → - Complete usage guide
- API Reference → - SDK API reference
- Quickstart → - Connect your existing API to an AI Voice Agent

