flutter_voximplant 1.0.0

  • Readme
  • Changelog
  • Installing
  • new57

flutter_voximplant #

Voximplant Flutter SDK for embedding voice communication into Flutter applications.

Demo #


Install #

Add flutter_voximplant as a dependency in your pubspec.yaml file.

iOS #

Add the following entry to your Info.plist file, located in <project root>/ios/Runner/Info.plist:

<string>Microphone is required to make audio calls</string>

This entry allows your app to access the microphone.

Android #

It is required to add Java 8 support.

Open <project root>android/app/build.gradle file and add the following lines to ‘android’ section:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8

Usage #

To get started, you'll need to register a free Voximplant developer account.

Initialization #

Client is the main class of the SDK that provides access to Voximplant’s functions, the Voximplant().getClient() method is used to get its instance:

import 'package:flutter_voximplant/flutter_voximplant.dart';

Client client = Voximplant().getClient();

Connect and log in to the Voximplant Cloud #

The Client.getClientState() method is used to get the current state of connection to the Voximplant cloud and perform the actions according to it.

  Future<String> loginWithPassword(String username, String password) async {
    ClientState clientState = await _client.getClientState();
    if (clientState == ClientState.LoggedIn) {
      return _displayName;
    if (clientState == ClientState.Disconnected) {
      await _client.connect();
    AuthResult authResult = await _client.login(username, password);
    _displayName = authResult.displayName;
    return _displayName;

Make calls #

To initiate a call we need the Client.call method. There is a CallSettings class which could contain custom data and extra headers (SIP headers).

Since the call can behave in different ways, there is a group of call events. They can be triggered by the Call class instance as the class contains all the functionality for call management.

  Future<Call> makeAudioCall(String number) async {
     Call call = await _client.call(number);
     call.onCallDisconnected = _onCallDisconnected;
     call.onCallFailed = _onCallFailed;
     call.onCallConnected = _onCallConnected;
     call.onCallRinging = _onCallRinging;
     call.onCallAudioStarted = _onCallAudioStarted;
     return call;
  _onCallConnected(Map<String, String> headers) {
      print('Call connected');

Receiving calls #

Client.onIncomingCall is used to get incoming calls.

There are three methods for an incoming call: answer, decline and reject. An audio stream can be sent only after the answer method call.

  CallService._() {
    _client = Voximplant().getClient();
    _client.onIncomingCall = _onIncomingCall;

  _onIncomingCall(Call call, Map<String, String> headers) async {
    await call.answer();

Mid-call operations #

Audio call can be put on/off hold

  _hold() async {
    try {
      await _call.hold(!_isOnHold);
      setState(() {
        _isOnHold = !_isOnHold;
    } catch (e) {


Audio device management #

AudioDeviceManager class API allow to:

  • get all available audio devices
  • get currently selected audio device
  • select audio device
  • handle active audio device changes and new audio devices (for example, Bluetooth headset or wired headset connection). These changes trigger the appropriate events.

All types of audio devices are represented in the AudioDevice enum.

Note that there are platform specific nuances in audio device management.

To select an audio device:

  _selectAudioDevice(AudioDevice device) async{
    AudioDeviceManager audioDeviceManager = Voximplant().getAudioDeviceManager();
    audioDeviceManager.onAudioDeviceChanged = _onAudioDeviceChange;
    await audioDeviceManager.selectAudioDevice(device);

  _onAudioDeviceChange(AudioDevice audioDevice) {
    // audio device is changed

1.0.0 #

  • Audio call functionality

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_voximplant: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_voximplant/flutter_voximplant.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Oct 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/flutter_voximplant.dart.

Run flutter format to format lib/flutter_voximplant.dart.

Format lib/src/call/call.dart.

Run flutter format to format lib/src/call/call.dart.

Format lib/src/call/endpoint.dart.

Run flutter format to format lib/src/call/endpoint.dart.

Fix additional 4 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/client/client.dart (Run flutter format to format lib/src/client/client.dart.)
  • lib/src/client/client_config.dart (Run flutter format to format lib/src/client/client_config.dart.)
  • lib/src/hardware/audio_device_manager.dart (Run flutter format to format lib/src/hardware/audio_device_manager.dart.)
  • lib/src/voximplant.dart (Run flutter format to format lib/src/voximplant.dart.)

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and flutter_voximplant.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies