Skip to main content
Version: 5.x.x

Getting Started - Flutter SDK

The Flutter SDK adds real-time audio and video to your Android and iOS apps.

SDK Compatibility​

Android and iOSWebmacOS and Windows
✅
❌
❌

v5.0.0 runs on Android and iOS only. If your app ships on the web, macOS or Windows, stay on v4.0.1. See Supported Device OS and Architecture for the minimum OS versions.

Installing Flutter SDK​

Flutter SDK is client for real-time communication for android and ios devices. It inherits the same terminology as all other SDKs does.

Step 1: Add this package in your flutter project​

VideoSDK flutter SDK can be added using the following command:

flutter pub add videosdk:^5.0.0

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
videosdk: ^5.0.0

Also pin permission_handler, which the SDK uses to ask for camera and microphone permission, to version 12. Version 13 brings in permission_handler_android 14, which builds only with Android Gradle Plugin 9, so an app on Android Gradle Plugin 8, the version Flutter 3.41 sets up, fails to build for Android.

flutter pub add permission_handler:^12.0.1

Step 2: Android Setup​

VideoSDK requires you to add following permissions to your app so that it can access the audio and video from the device.

Ensure the following permission is present in your Android Manifest file, located in <project root>/android/app/src/main/AndroidManifest.xml:

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />

If you need to use a Bluetooth device, please add:

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />

BLUETOOTH_CONNECT is needed on Android 12 and later, and BLUETOOTH on Android 11 and earlier. On Android 12 and later, also ask for it at runtime with VideoSDK.requestBluetoothPermission().

Also you will need to set your build settings to Java 17, because recent versions of the Android Gradle Plugin and the SDK's Android dependencies require it. Just add this to your app-level android/app/build.gradle.kts:

android/app/build.gradle.kts
android {
//...
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
Update the minimumSdkVersion for android​

In the same build.gradle.kts, set minSdk of defaultConfig to 24 or higher. The SDK needs Android 7.0 (API level 24) or later.

Build for ARM ABIs only​

The SDK ships its native libraries for arm64-v8a and armeabi-v7a, so it does not run on x86 and x86_64 emulators. Test on an ARM device or on an emulator with an arm64-v8a system image. To keep Google Play from offering your app to other devices, add an ABI filter in the same file:

android/app/build.gradle.kts
android {
defaultConfig {
//...
ndk {
abiFilters += listOf("arm64-v8a", "armeabi-v7a")
}
}
}

Then add this line to android/gradle.properties. Without it, Flutter adds its own ABIs to the filter and yours has no effect. It needs Flutter 3.41 or later.

android/gradle.properties
disable-abi-filtering=true
note

If your project uses the Groovy DSL (android/app/build.gradle), write minSdk = 24 and ndk { abiFilters 'arm64-v8a', 'armeabi-v7a' } there instead.

Keep the SDK's classes in release builds​

Flutter shrinks every Android release build with R8. The SDK loads its videosdk.org classes by name, so R8 removes or renames them unless you keep them. Add these rules to android/app/proguard-rules.pro, and create the file if your app does not have one:

android/app/proguard-rules.pro
-keep class videosdk.org.** { *; }
-dontwarn videosdk.org.**

Keep the -dontwarn line, because the keep rule alone fails the build with a missing-class error.

caution

The SDK does not ask the user for camera and microphone permission on Android. Ask with VideoSDK.requestPermissions() before you join a room, as the Quick Start does.

Step 3: iOS Setup​

VideoSDK requires you to add following permissions to your app so that it can access the audio and video from the device.

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

<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) Camera Usage!</string>
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) Microphone Usage!</string>
Turn on Swift Package Manager​

The SDK's iOS plugin ships as a Swift Package, so it needs Flutter 3.41 or later with Swift Package Manager turned on. Turn it on for your project by adding config: under the existing flutter: section of your app's pubspec.yaml:

pubspec.yaml
flutter:
config:
enable-swift-package-manager: true

Or run flutter config --enable-swift-package-manager on every machine that builds your app, including CI.

Set the iOS deployment target​

Set your app's iOS deployment target to 18.0 or higher. In Xcode, open ios/Runner.xcworkspace, select the Runner target and set Minimum Deployments to 18.0. If your project has an ios/Podfile, set platform :ios, '18.0' there too.

The SDK runs in the iOS Simulator only on a Mac with Apple silicon.

To share the screen from an iOS device, also set up a Broadcast Upload Extension, as described in Flutter iOS Screen Share.

Step 4: Import it​

Now in your Dart code, you can use:

import "package:videosdk/videosdk.dart";
note

Check out official example of Flutter SDK implementation: videosdk-rtc-flutter-sdk-example. The example still uses Flutter SDK v4.0.1. To build an app on v5.0.0, follow the Quick Start.

Got a Question? Ask us on discord