# Add a Video Conference feature to your Flutter App

In this article, I will explain how to quickly and easily add video conferencing functionality to your application.

This kind of technology usually involves a significant amount of work behind it. Not only do you need to understand how to implement and manage costly audio and video servers along with their respective video streaming technologies, but you also need to know how to properly integrate it into your frontend app, all while keeping latency to a minimum.

For this reason, [ZEGOCLOUD](https://www.zegocloud.com/), a company I've been working with for some time, provides state-of-the-art solutions in this field, offering you these capabilities without the need to worry about infrastructure costs or dedicating effort to integrate them into your app. With their UIKit, you can add another widget to your Flutter application that will automatically connect to your system and enable you to incorporate video conferencing functionality into your app in just a few minutes.

To do this, I'm going to show you the steps one by one that you need to follow to accomplish it. The first step is to visit the [official ZEGOCLOUD website and sign up](https://console.zegocloud.com/account/signup). Everything I'm going to explain here can be tried with a free account, **without the need to add any payment method**. This way, you can evaluate the service and see it in action without any cost.

## Create the project in the ZEGOCLOUD Dashboard

The first thing you should do is create a project. You can do it by clicking on the *"Create"* button in the upper right corner, in the *"Projects"* section:

![Create a project](https://cdn.hashnode.com/res/hashnode/image/upload/v1686215454881/727dc8f0-0013-4dcb-b011-b3e88188ce58.png align="center")

Next, you will be prompted to select the use case for your project. As you can see, there are numerous options to choose from; in this instance, we will select *"Video Conference"*:

![Select Video Conference use-case](https://cdn.hashnode.com/res/hashnode/image/upload/v1686215491507/484b3444-ab72-499c-b61d-2cc0affba0a0.png align="center")

Let's give the project a name:

![Add a name to the project](https://cdn.hashnode.com/res/hashnode/image/upload/v1686215509366/477f9670-5554-42f4-b3db-f25461f97ba5.png align="center")

You have two options: one is to use their SDK for a fully custom implementation, where you can decide exactly how to interact with their services. The other option is to use a [**UIKit**](https://www.zegocloud.com/uikits), which allows you to add a widget and have all the functionality implemented, including the visual interface.

Since we want to add this functionality as quickly as possible, we'll choose the *"Start with UIKits"* option:

![Start with UIKits](https://cdn.hashnode.com/res/hashnode/image/upload/v1686215570062/868e7813-c427-426e-ba48-35d4827701f3.png align="center")

Then we can choose the platform on which we want to work, for this tutorial we will do it on a Flutter application:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686215587431/bc95ead4-16cc-4db3-b476-1bb31400f867.png align="center")

Everything is ready, press the *"Save & Start to integrate"* button and your project will be ready to be implemented.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686215600490/2fdfb149-8be5-4c8a-bc61-f83d450c9b12.png align="center")

Now you can view your project's configuration. You'll see your **AppID** and **AppSign**. Save these values, as you'll need them later to connect your app to the project you just created.

## Add a Video Conference feature to your Flutter app

Now the fun part! Create a new Flutter application and add the following dependencies:

```bash
flutter create --platform android,ios flutter_video_conference
cd flutter_video_conference
flutter pub add zego_uikit_prebuilt_video_conference
flutter pub add uuid
```

The [zego\_uikit\_prebuilt\_video\_conference](https://pub.dev/packages/zego_uikit_prebuilt_video_conference) plugin incorporates the UIKit for adding the Video Conference feature. We'll also add [uuid](https://pub.dev/packages/uuid) to generate random identifiers for this example.

Before start developing, we must do some setup. Start by changing the following variables in `android/app/build.gradle`:

```bash
compileSdkVersion 33
minSdkVersion 22
targetSdkVersion 33
```

To add this feature, we must add the following permissions to `android/app/src/main/AndroidManifest.xml`:

```bash
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
```

We should do the same for iOS. Open `ios/Podfile` and modify the last part of the file with the following addition:

```bash
post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)

    # Add this block
    target.build_configurations.each do |config|
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',
        'PERMISSION_CAMERA=1',
        'PERMISSION_MICROPHONE=1',
      ]
    end
  end
end
```

Declare the permissions in `ios/Info.plist`:

```bash
<key>NSCameraUsageDescription</key>
<string>Camera access is required to create a Video Conference</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is required to create a Video Conference</string>
```

Great! Now everything is ready to start developing. Copy and paste the following Dart code in your `lib/main.dart` file. I've added several comments to the code so you can fully understand what I'm doing and how you can extend it further if you want:

```dart
import 'package:flutter/material.dart';
import 'package:uuid/uuid.dart';
import 'package:zego_uikit_prebuilt_video_conference/zego_uikit_prebuilt_video_conference.dart';

void main() {
  runApp(const App());
}

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Video Conference',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MainScreen(),
    );
  }
}

class MainScreen extends StatefulWidget {
  const MainScreen({Key? key}) : super(key: key);

  @override
  State<MainScreen> createState() => _MainScreenState();
}

class _MainScreenState extends State<MainScreen> {
  // This is the ID of this conference. We'll use this harcoded value
  // for now, but you should use a custom ID managed by your system
  // in order to manage all conferences.
  final String _conferenceId = 'my_conference';

  late final String _userId;
  late final String _userName;

  @override
  void initState() {
    super.initState();

    // We will create a random ID for now. But you should
    // use the ID that you already use for your users, 
    // and the username that each of them have.
    _userId = const Uuid().v4();
    _userName = 'user_${_userId.substring(0, 7)}';
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      // You just need to add this widget in order to
      // add the functionality to your app.
      child: ZegoUIKitPrebuiltVideoConference(
        // Add the AppID and AppSign that you saw before in
        // the project configuration in the Dashboard
        appID: your_app_id,
        appSign:
            'your_app_sign',
        userID: _userId,
        userName: _userName,
        conferenceID: _conferenceId,
        config: ZegoUIKitPrebuiltVideoConferenceConfig(),
      ),
    );
  }
}
```

Execute this code on two devices if possible. You will observe that you can engage in a video conference with your colleagues.

If you are looking for deeper requirements with video call SDK, ZEGOCLOUD also has a fully customized [video calling SDK](https://www.zegocloud.com/product/video-call) to meet your requirements.

And just like that you can have this feature implemented without the hassle of managing servers. Thanks to ZEGOCLOUD for sponsoring this article, and don't hesitate to go to [their website](https://www.zegocloud.com/) to see more information about their services.

Happy coding!
