Flutter UI Kit — Installation
The Flutter UI Kit is distributed via pub.dev. Add it as a dependency in your
pubspec.yaml, grant platform permissions, and request them at runtime
before starting a call. Follow the four steps below to get fully set up.
Open your project's pubspec.yaml and add the UI Kit under dependencies:
dependencies:
enx_uikit_flutter: ^2.0.4
Then fetch the package:
flutter pub get
Android — Local Libraries Repository
The UI Kit bundles native Android libraries. You must tell Gradle where to find them by adding a
flatDir entry to your project-level build.gradle:
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'src/main/libs'
dirs project(':enx_flutter_plugin').file('libs')
}
}
}
This change goes in the project-level build.gradle
(the one in your android/ folder), not the app-level one inside
android/app/.
The UI Kit requires camera and microphone access. Both platforms need these declared in their manifest/plist before the OS will grant them at runtime.
Android — AndroidManifest.xml
Add the following <uses-permission> entries inside the
<manifest> tag of
android/app/src/main/AndroidManifest.xml:
<manifest>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>
iOS — Info.plist
Add usage description strings to ios/Runner/Info.plist. iOS will display these
messages in the system permission dialog shown to the user:
| Key | Value |
|---|---|
NSCameraUsageDescription |
EnableX needs camera access to work |
NSMicrophoneUsageDescription |
EnableX needs microphone access to work |
Declaring permissions in the manifest/plist is not enough — you must explicitly request them from the user before starting a call. The example below uses the permission_handler package. If the user has permanently denied a permission, the function redirects them to app settings.
import 'package:permission_handler/permission_handler.dart';
Future<bool> handlePermissionsForCall(BuildContext context) async {
Map<Permission, PermissionStatus> statuses = await [
Permission.camera,
Permission.microphone,
].request();
if (statuses[Permission.camera]!.isPermanentlyDenied ||
statuses[Permission.microphone]!.isPermanentlyDenied) {
openAppSettings();
return false;
}
return !statuses[Permission.camera]!.isDenied &&
!statuses[Permission.microphone]!.isDenied;
}
Call this function before navigating to the screen that contains
EnxVideoView. Only proceed to the call if the function returns true.
Every EnableX session requires a valid room token. Your app server creates the room and generates
the token using the EnableX Video API, then passes it to the client app. The Flutter UI Kit consumes
this token when initialising EnxVideoView.
See the Video API reference for details on room creation and token generation.
Token generation requires your EnableX App ID and App Key, which must never be shipped in a mobile app. Always obtain tokens from your server and pass them to the client.