td_live_chat
Add ThriveDesk live chat to your Flutter app. Your users can talk to your
support team (including your AI assistant) without ever leaving the app — all
you need is the assistantId from your ThriveDesk dashboard.
Two ways to add the chat:
- Floating bubble (recommended) — a small assistant bubble sits in the bottom corner (left or right, following your dashboard's "Launcher position" setting) and expands to full screen when tapped.
- Button — call
TdLiveChat.show(context)from anyonPressedto push a full-screen chat.
Install
flutter pub add td_live_chat
Or add it manually to your app's pubspec.yaml:
dependencies:
td_live_chat: ^1.0.1
Then:
flutter pub get
Usage
Floating bubble (recommended)
import 'package:flutter/material.dart';
import 'package:td_live_chat/td_live_chat.dart';
void main() {
TdLiveChat.init(
assistantId: 'YOUR_ASSISTANT_ID',
// Optional: control where the bubble appears.
// showOn: ['/home'], // allow-list
// hideOn: ['/login'], // deny-list
// Optional: raise the bubble vertically, e.g. to clear a bottom nav bar.
// launcherBottomOffset: 56,
);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
navigatorObservers: [TdLiveChat.routeObserver],
builder: TdLiveChat.overlay,
home: const Scaffold(body: Center(child: Text('Home'))),
);
}
}
Button
If the floating bubble doesn't fit your app (e.g. you can't wire
navigatorObservers or builder), open the chat from your own button instead.
Call TdLiveChat.init(...) once at startup first — no navigatorObservers or
builder: TdLiveChat.overlay wiring is needed for this mode.
void main() {
TdLiveChat.init(assistantId: 'YOUR_ASSISTANT_ID');
runApp(const MyApp());
}
// then, from any onPressed:
ElevatedButton(
onPressed: () => TdLiveChat.show(context),
child: const Text('Chat with us'),
);
The chat opens as a full-screen route and pops itself when closed. Use
TdLiveChat.hide(context) to dismiss it programmatically.
Configuration
| Param | Type | Description |
|---|---|---|
assistantId |
String |
Copied from the ThriveDesk dashboard install screen |
showOn |
List<String>? |
Allow-list of route names to show the bubble on |
hideOn |
List<String>? |
Deny-list of route names to hide the bubble on |
launcherBottomOffset |
double |
Raises the bubble by this many logical px, e.g. to clear a bottom nav bar (default 0) |
loggingEnabled |
bool |
Log SDK errors (default false) |
showOn and hideOn are mutually exclusive. launcherBottomOffset only moves
the bubble vertically — the left/right side still follows the dashboard's
"Launcher position" setting.
Example
See the example/ directory for a runnable app.
License
MIT — see LICENSE.