Developer Documentation
Add live customer support to your Flutter app in minutes. Your users chat in-app, your team responds in Slack.
Introduction #
FlutterChatIO is a customer support SDK that connects your Flutter app directly to your Slack workspace. When users send messages in your app, they appear in your Slack channel. When your team replies in Slack, users see the response instantly.
Slack Integration
Messages route directly to Slack. No separate dashboard needed.
Unlimited Operators
Anyone in your Slack workspace can respond. No per-seat pricing.
Real-time Sync
Instant message delivery via WebSocket with auto-reconnection.
Fully Themeable
Customize colors, typography, and text to match your brand.
Platforms: FlutterChatIO currently supports iOS and Android. Device information is automatically detected and sent to your Slack workspace.
Installation #
Add FlutterChatIO to your pubspec.yaml:
dependencies:
flutter_chat_io: ^2.1.0
Then run:
flutter pub get
Quick Start #
Get up and running in three steps:
Set up your project
Visit flutterchat.io/account/dashboard to connect your Slack workspace and get your client ID and client token.
Initialize the SDK
Add initialization to your main() function:
import 'package:flutter_chat_io/flutter_chat_io.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
FlutterChatIO.initialize(
clientId: 'your-client-id',
clientToken: 'your-client-token',
);
runApp(MyApp());
}
Show the chat
Navigate to the chat widget when users tap your support button:
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => const FlutterChatIOChat(),
),
);
Initialization #
The FlutterChatIO.initialize() method configures the SDK. Call it once at app startup before using any other SDK features.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
clientId |
String |
Required | Your project client ID from the dashboard |
clientToken |
String |
Required | Your project client token from the dashboard |
Example
FlutterChatIO.initialize(
clientId: 'your-client-id',
clientToken: 'your-client-token',
);
Check Initialization Status
if (FlutterChatIO.isInitialized) {
// SDK is ready
Navigator.push(context, route);
} else {
showError('Chat not configured');
}
User Identity #
Provide user context so your team knows who they're talking to in Slack. This information appears alongside messages in your Slack channel.
Setting User ID
Link conversations to your user accounts:
// After user authentication
FlutterChatIO.setUserId(userId: user.id);
Setting User Info
Provide additional context for your support team. Device information is automatically detected by the SDK:
FlutterChatIO.setUserInfo(
email: '[email protected]',
userName: 'John Doe',
customData: {
'subscription': 'premium',
'accountType': 'business',
'signupDate': '2024-01-15',
},
);
Resetting on Logout
void onLogout() {
FlutterChatIO.reset();
// Navigate to login screen
}
Chat Widget #
FlutterChatIOChat is the main widget that displays the chat interface. It handles:
- Real-time messaging via WebSocket
- Message history loading
- Image attachments
- Connection status indicators
- Offline contact form
- Auto-reconnection
FlutterChatIOChat(
theme: FlutterChatIOTheme(
appBarTitle: 'Help Center',
appBarColor: Colors.indigo,
),
)
Theming #
Customize the chat appearance using FlutterChatIOTheme:
FlutterChatIOChat(
theme: FlutterChatIOTheme(
// AppBar
appBarColor: Colors.indigo,
appBarTitle: 'Help Center',
// Message bubbles
outgoingMessageColor: Colors.indigo,
incomingMessageColor: Colors.grey.shade200,
// Status indicators
onlineColor: Colors.green,
offlineColor: Colors.red,
connectingColor: Colors.orange,
// Empty state
emptyStateTitle: 'How can we help?',
emptyStateSubtitle: 'Send us a message',
// Input field
inputBackgroundColor: Colors.white,
sendButtonColor: Colors.indigo,
),
)
Localization #
Customize all text content for different languages. You can either manually set all strings or use the built-in localized factory:
Manual Localization
FlutterChatIOTheme(
// Spanish localization
appBarTitle: 'Soporte',
emptyStateTitle: 'Bienvenido',
emptyStateSubtitle: 'Envíanos un mensaje',
offlineFormTitle: 'Estamos fuera de línea',
offlineFormSubtitle: 'Deja tu información',
offlineFormButtonText: 'Continuar',
offlineFormNameHint: 'Tu nombre',
offlineFormEmailHint: 'Tu email',
supportUserName: 'Soporte',
)
Built-in Localization
Use the localized factory constructor for automatic localization:
// Use device locale
FlutterChatIOChat(
theme: FlutterChatIOTheme.localized(
Localizations.localeOf(context),
),
)
// Or use specific locale
FlutterChatIOChat(
theme: FlutterChatIOTheme.localized(
const Locale('es'),
appBarColor: Colors.indigo, // Still customizable
),
)
Supported Locales: English (en), Chinese (zh), Spanish (es), Arabic (ar), Hindi (hi), Russian (ru). English is used as fallback for unsupported locales.
Locale Matching: The SDK first tries to match the full locale code (e.g., 'zh_CN'), then falls back to the language code (e.g., 'zh'), and finally defaults to English if no match is found.
API Reference #
FlutterChatIO
| Method | Description |
|---|---|
initialize() |
Initialize the SDK with your client ID and client token |
setUserId() |
Set the current user's unique identifier |
setUserInfo() |
Set additional user information (email, name, customData) |
reset() |
Clear all user information |
FlutterChatIOChat
| Property | Type | Description |
|---|---|---|
theme |
FlutterChatIOTheme |
Theme configuration for the chat widget |
Theme Properties #
AppBar
| Property | Type | Default |
|---|---|---|
appBarColor |
Color |
Blue (#1976D2) |
appBarTitle |
String |
"Support" |
appBarTitleTextStyle |
TextStyle |
17px, semi-bold, white |
appBarSubtitleTextStyle |
TextStyle |
13px, white70 |
statusOnline |
String |
"Online" |
statusOffline |
String |
"Offline" |
statusConnecting |
String |
"Connecting..." |
Background
| Property | Type | Default |
|---|---|---|
backgroundColor |
Color |
Light grey (#F5F5F5) |
backgroundGradient |
Gradient? |
null (optional) |
Messages
| Property | Type | Default |
|---|---|---|
incomingMessageColor |
Color |
Light grey (#E8E8E8) |
outgoingMessageColor |
Color |
Blue (#1976D2) |
incomingMessageTextStyle |
TextStyle |
15px, dark grey |
outgoingMessageTextStyle |
TextStyle |
15px, white |
incomingTimeTextStyle |
TextStyle |
11px, medium grey |
outgoingTimeTextStyle |
TextStyle |
11px, white70 |
Status Indicators
| Property | Type | Default |
|---|---|---|
onlineColor |
Color |
Green (#4CAF50) |
offlineColor |
Color |
Red (#F44336) |
connectingColor |
Color |
Orange (#FF9800) |
Input Field
| Property | Type | Default |
|---|---|---|
inputBackgroundColor |
Color |
White |
inputTextColor |
Color |
Dark grey (#212121) |
inputHintColor |
Color |
Grey (#9E9E9E) |
sendButtonColor |
Color |
Blue (#1976D2) |
keyboardAppearance |
Brightness |
Brightness.light |
sendButtonDisabledColor |
Color |
Grey (#BDBDBD) |
attachmentIcon |
IconData |
Icons.image_outlined |
Empty State
| Property | Type | Default |
|---|---|---|
emptyStateTitle |
String |
"Welcome to Support" |
emptyStateSubtitle |
String |
"Send us a message to get started" |
emptyStateTitleStyle |
TextStyle |
20px, semi-bold, dark grey |
emptyStateSubtitleStyle |
TextStyle |
14px, grey |
Offline Form
| Property | Type | Default |
|---|---|---|
offlineFormTitle |
String |
"We're currently offline" |
offlineFormSubtitle |
String |
"Leave your contact info and we'll get back to you:" |
offlineFormButtonText |
String |
"Continue to chat" |
offlineFormNameHint |
String |
"Your name" |
offlineFormEmailHint |
String |
"Your email" |
offlineFormNameEmailError |
String |
"Please enter your name and email" |
offlineFormEmailValidError |
String |
"Please enter a valid email" |
Chat Configuration
| Property | Type | Default |
|---|---|---|
supportUserName |
String |
"Support" |
currentUserName |
String |
"You" |
systemUserName |
String |
"System" |
Error Messages
| Property | Type | Default |
|---|---|---|
errorNotConnected |
String |
"Not connected to server" |
errorUploadFailed |
String |
"Upload failed" |
errorLoadingHistory |
String |
"Error loading history" |
Troubleshooting #
SDK not initialized
If you see an assertion error about initialization, ensure you call FlutterChatIO.initialize() before using the chat widget:
// In main.dart
void main() {
WidgetsFlutterBinding.ensureInitialized();
FlutterChatIO.initialize(
clientId: 'your-client-id',
clientToken: 'your-client-token',
);
runApp(MyApp());
}
Messages not appearing in Slack
If messages aren't appearing in your Slack workspace, check the following:
- Verify your
clientIdandclientTokenare correct - Check your Slack workspace connection in the dashboard
- Ensure the target Slack channel exists and the bot has access
Connection issues
The SDK automatically reconnects on connection loss. If you're experiencing persistent connection issues, check:
- Device has internet connectivity
- Firewall isn't blocking WebSocket connections to
wss://ws.flutterchat.io - Client token hasn't expired or been revoked
Need help? Contact us at [email protected]