You have a Flutter app and you want users to talk to a support assistant inside it. Two packages get you there from different ends. elevenlabs_agents is a voice session client: it runs the call, and you draw everything around it. widget_chat is a finished chat screen with a voice call in it.
This post builds the same feature both ways. The facts come from elevenlabs_agents 0.6.1 and widget_chat 0.0.29, the latest versions on pub.dev on 1 December 2026.
What each package is
elevenlabs_agents is the official ElevenLabs Flutter SDK. It carries full-duplex audio over WebRTC through LiveKit, for agents you configure at ElevenLabs. Its README covers text messages, client tools, dynamic variables, per-session overrides, response feedback, and public or private agents. It lists Android and iOS as supported platforms, and version 0.6.0 raised the minimum to Flutter 3.38.
widget_chat is a drop-in AI chat widget. Voice appears as a mic button in the chat composer, or as VoiceCallView, a voice-only screen. It runs in Flutter apps on iOS, Android and web.
The Flutter version will not settle the choice: widget_chat 0.0.29 requires Dart 3.10.1 or later, so it needs a recent toolchain too.
Who builds what
| Piece | elevenlabs_agents | widget_chat |
|---|---|---|
| Call screen | You, from status, isSpeaking and isMuted |
Included |
| Transcript and captions | You, from callbacks such as onMessage |
Included, can be off by default |
| Interruption | Handled in the session, with an onInterruption callback |
Included barge-in |
| Session token for a private agent | Your backend | None for you to build |
| Mic declaration | Your app | Your app |
| Mic runtime request | Your app (README uses permission_handler) |
The package asks when the call starts |
| Text chat screen | You, using sendUserMessage |
Included, same conversation as the mic button |
| Product cards during a call | You, for example from a client tool | Included |
| Call interface design | Entirely yours | The package's screen, following the chat theme |
Where the private-agent token request sits
A public agent starts with only an agent ID. A private agent needs a conversation token. Creating one takes an ElevenLabs API key, which must never ship in the app, so a server of yours sits between the two.
The documented endpoint is a GET that takes an agent_id and returns token and conversation_id. A small Express route covers it. requireUser is your own auth middleware, and Node 18 or later provides fetch:
app.post('/voice/token', requireUser, async (req, res) => {
const url = new URL('https://api.elevenlabs.io/v1/convai/conversation/token');
url.searchParams.set('agent_id', process.env.ELEVENLABS_AGENT_ID);
try {
const upstream = await fetch(url, {
headers: { 'xi-api-key': process.env.ELEVENLABS_API_KEY },
});
if (!upstream.ok) return res.status(502).json({ error: 'token_failed' });
const { token } = await upstream.json();
res.json({ token });
} catch {
res.status(502).json({ error: 'token_failed' });
}
});
Build it with elevenlabs_agents
Add the packages:
flutter pub add elevenlabs_agents permission_handler http
This screen uses the README API: a ConversationClient, callbacks, a token and a mute button. Replace the token URL with your own.
import 'dart:convert';
import 'package:elevenlabs_agents/elevenlabs_agents.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:permission_handler/permission_handler.dart';
class VoiceSupportScreen extends StatefulWidget {
const VoiceSupportScreen({
super.key,
required this.sessionJwt,
required this.userId,
});
final String sessionJwt;
final String userId;
@override
State<VoiceSupportScreen> createState() => _VoiceSupportScreenState();
}
class _VoiceSupportScreenState extends State<VoiceSupportScreen> {
final _lines = <String>[];
late final ConversationClient _client;
@override
void initState() {
super.initState();
_client = ConversationClient(
callbacks: ConversationCallbacks(
onMessage: ({required message, required source}) {
if (mounted) setState(() => _lines.add('${source.name}: $message'));
},
onError: (message, [context]) => debugPrint('Voice error: $message'),
),
)..addListener(_refresh);
}
void _refresh() {
if (mounted) setState(() {});
}
Future<void> _start() async {
final mic = await Permission.microphone.request();
if (!mic.isGranted) {
_show('Microphone access is needed for a call.');
return;
}
try {
final response = await http.post(
Uri.parse('https://api.example.com/voice/token'),
headers: {'Authorization': 'Bearer ${widget.sessionJwt}'},
);
if (response.statusCode != 200) throw Exception('No token');
final body = jsonDecode(response.body) as Map<String, dynamic>;
if (!mounted) return;
await _client.startSession(
conversationToken: body['token'] as String,
userId: widget.userId,
dynamicVariables: {'account_tier': 'premium'},
);
} catch (_) {
_show('The call could not start.');
}
}
void _show(String text) {
if (!mounted) return;
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text(text)));
}
@override
void dispose() {
_client.removeListener(_refresh);
_client.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final connected = _client.status == ConversationStatus.connected;
final idle = _client.status == ConversationStatus.disconnected;
return Scaffold(
appBar: AppBar(
title: Text(_client.isSpeaking ? 'Speaking' : _client.status.name),
),
body: ListView(
children: [for (final line in _lines) ListTile(title: Text(line))],
),
bottomNavigationBar: SafeArea(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
if (idle)
FilledButton(onPressed: _start, child: const Text('Call')),
if (connected) ...[
IconButton(
onPressed: () => _client.toggleMute(),
icon: Icon(_client.isMuted ? Icons.mic_off : Icons.mic),
),
FilledButton(
onPressed: () => _client.endSession(),
child: const Text('End'),
),
],
],
),
),
);
}
}
That is a working call with a plain transcript. Streaming captions, a polished status display, reconnection, saved history and product cards are still yours to write. Our post on a listening, speaking and barge-in status UI shows what the status part involves.
Per-session voice or prompt changes go through ConversationOverrides. ElevenLabs requires each overridable field to be enabled in the agent's security settings, and its docs recommend dynamic variables as the preferred way to personalize.
Build it with widget_chat
Enable voice in the dashboard's Voice section, where you also set the voice name, session length and captions default. Then install the package:
flutter pub add widget_chat
For text and voice together, place ChatWidget in your app. The mic button appears in the composer when voice is enabled for the project and included in its plan. The call and the text chat share one conversation.
For a voice-only screen, push VoiceCallView:
import 'package:flutter/material.dart';
import 'package:widget_chat/widget_chat.dart';
void openVoiceSupport(BuildContext context, String userId) {
final messenger = ScaffoldMessenger.of(context);
Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (_) => VoiceCallView(
configuration: BotConfiguration(
projectSecretKey: 'your-project-secret-key',
userID: userId,
userContext: {'account_tier': 'premium'},
),
captionsDefault: true,
onEnded: (outcome) {
if (!outcome.startedSuccessfully) {
final denied = outcome.error is VoiceMicPermissionDenied;
messenger.showSnackBar(
SnackBar(
content: Text(
denied
? 'Allow the microphone in Settings.'
: 'The call could not start.',
),
),
);
return;
}
for (final caption in outcome.captions) {
debugPrint('${caption.isUser ? 'user' : 'bot'}: ${caption.text}');
}
},
),
),
);
}
VoiceCallView hands the transcript to your code in onEnded. Choose the composer mic when you want the spoken turns in the chat thread. See product cards while voice AI talks for the visual side, and the FlutterFlow voice assistant guide for the custom widget setup, which needs a paid FlutterFlow plan.
Microphone permissions on iOS and Android
Both options need platform declarations, because neither package can write your app's permission text.
- iOS usage textAdd NSMicrophoneUsageDescription to ios/Runner/Info.plist with a sentence that explains the voice call.
- Android permissionAdd RECORD_AUDIO and INTERNET to android/app/src/main/AndroidManifest.xml.
- ElevenLabs extrasIts README also lists MODIFY_AUDIO_SETTINGS and CAMERA for Android, and iOS 13.0 as the minimum.
- permission_handler on iOSWith CocoaPods, enable PERMISSION_MICROPHONE=1 in the Podfile; with Swift Package Manager it reads the Info.plist key.
- Test a refusalDeny the prompt on a real device and check that your app explains how to turn the mic back on.
<!-- ios/Runner/Info.plist -->
<key>NSMicrophoneUsageDescription</key>
<string>The microphone lets you talk to our support assistant.</string>
<!-- android/app/src/main/AndroidManifest.xml -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
When ElevenLabs is the better choice
Pick the ElevenLabs Flutter SDK when the voice session itself is what you are building.
| Your requirement | Better fit | Reason |
|---|---|---|
| A different voice per user or session | ElevenLabs | TtsOverrides takes a voice ID and voice settings |
| A fully custom call interface | ElevenLabs | It provides state and callbacks, and you own the pixels |
| Voice is the core product | ElevenLabs | Device-side tools, VAD scores and raw events are exposed |
| Data residency endpoints | ElevenLabs | The client accepts custom API and WebSocket URLs |
| A feature only its SDK documents | ElevenLabs | Examples are MCP callbacks and response feedback events |
| Support chat with voice as one input | widget_chat | Text, voice and cards share one screen |
| No token service or call UI to maintain | widget_chat | Both are covered by the package |
| The same voice feature in a Flutter web app | widget_chat | The ElevenLabs README lists only Android and iOS |
On residency, check the hosts with ElevenLabs before you ship. The SDK README shows an EU API host without residency in its name, while the residency docs list api.eu.residency.elevenlabs.io and describe residency as an Enterprise feature. The README also says both URLs must point to the same region.
Add the finished voice and chat screen
If you want an ElevenLabs alternative in Flutter because the goal is in-app support, Widget-Chat ships the whole chat screen, with answers from your own content and provider keys kept server-side:
ChatWidget(
configuration: BotConfiguration(
projectSecretKey: 'your-project-secret-key',
userID: 'user-123',
),
)
Start with text chat on the free plan, no credit card needed, then check the voice minutes on your plan before you turn on calls. Create your free Widget-Chat account to get a project key.





