Logo
Search
API Docs

Flutter SDK Integration

Chat Agents

Flutter SDK Integration & Mobile Voice Calls

Overview

The Flutter SDK lets you add voice-assistant calling to a native iOS or Android app (or a Flutter web build) from a single Dart codebase. It follows the same client-instantiate-and-call model as the Web SDK Integration guide, so if you've already built a browser-based integration the concepts here will be familiar — you're just doing it from a Flutter widget instead of a JavaScript client.


Installation

Add the Flutter package to your pubspec.yaml:

dependencies:
  sulus_voice_flutter: ^1.0.0

Then fetch the dependency:

flutter pub get

Basic Voice Call Integration

Import the package and instantiate the client with your public API key. A simple stateful widget can start and end a call with a single button:

import 'package:sulus_voice_flutter/sulus_voice_flutter.dart';

class VoiceWidget extends StatefulWidget {
  @override
  _VoiceWidgetState createState() => _VoiceWidgetState();
}

class _VoiceWidgetState extends State<VoiceWidget> {
  final SulusVoiceClient _sulusVoice = SulusVoiceClient('YOUR_PUBLIC_API_KEY');
  bool _isConnected = false;

  @override
  Widget build(BuildContext context) {
    return ElevatedButton(
      onPressed: () {
        if (_isConnected) {
          _sulusVoice.stop();
        } else {
          _sulusVoice.start('YOUR_ASSISTANT_ID');
        }
        setState(() {
          _isConnected = !_isConnected;
        });
      },
      child: Text(_isConnected ? 'End Call' : 'Start Call'),
    );
  }
}
  • Initialize the client with your public API key via SulusVoiceClient('YOUR_PUBLIC_API_KEY')
  • Start a call with _sulusVoice.start('YOUR_ASSISTANT_ID')
  • Stop a call with _sulusVoice.stop()

The Flutter SDK supports iOS and Android, as well as Flutter Web builds.


Prerequisites

  • A Sulus account with access to your public API key (found in your dashboard)
  • An existing assistant ID for the voice assistant you want to connect to

Next Steps

  • Create an assistant from the dashboard, or programmatically with a server-side SDK, if you don't have an assistant ID yet
  • Handle call lifecycle events (call started, call ended, speech started/ended) to drive your app's UI state
  • Display a live transcript by subscribing to message events as the call progresses

For the conceptual browser-based equivalent of this integration, see Web SDK Integration.