zego_express_engine 0.11.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 83

zego_express_engine pub package #

English | 中文

ZegoExpressEngine Audio/Video Flutter SDK is a flutter plugin wrapper based on ZegoExpressEngine native Android / iOS SDK, providing live video and real-time audio/video services. It only needs 4 lines of code and can be easily accessed in 30 minutes.

Learn more about the solution: https://www.zego.im

1️⃣ Download and Install Flutter #

Flutter Get Started #

2️⃣ Configuration development environment #

  • Android Studio: Preferences -> Plugins, search for the Flutter plugin to download, configure the first step to download the Flutter SDK path in the plugin.

  • VS Code: Search for the Flutter extension in the app store and download

After configuring the flutter environment in any of the above development environments, execute the flutter doctor on the command line and complete the related undownloaded dependencies according to the prompts.

3️⃣ Apply for ZEGO AppID #

Log in to ZEGO Official Website to register an account, select a scenario according to your actual business needs, and obtain AppID and App Sign for initializing the SDK.

4️⃣ Import zego_express_engine #

Open the pubspec.yaml in the project and add the zego_express_engine dependency:

  sdk: flutter

  zego_express_engine: ^0.11.0
  • Depends on git #

  sdk: flutter

      url: git://github.com/zegoim/zego-express-flutter-sdk.git
      ref: master

After saving the file, execute flutter pub get

5️⃣ Add device permissions #

Android #

Open the file app/src/main/AndroidManifest.xml, and add the following contents:

Add Android Privacy

    <!-- Permissions required by the SDK -->
    <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" />
    <!-- Permissions required by the App -->
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

        android:required="true" />

    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />

Note: Because Android 6.0 requires dynamic permissions for some of the more important permissions, you cannot apply for static permissions only through the AndroidMainfest.xml file. Therefore, you need to refer to the following code (requestPermissions is the Activity method)

String[] permissionNeeded = {

    if (ContextCompat.checkSelfPermission(this, "android.permission.CAMERA") != PackageManager.PERMISSION_GRANTED ||
        ContextCompat.checkSelfPermission(this, "android.permission.RECORD_AUDIO") != PackageManager.PERMISSION_GRANTED) {
        requestPermissions(permissionNeeded, 101);

iOS #

Choose the option TARGETS -> Info -> Custom iOS Target Properties

Add iOS Privacy

Click the + Add button to add camera and microphone permissions.

  1. Privacy - Camera Usage Description

  2. Privacy - Microphone Usage Description

After adding permissions, it will be as shown:

Add iOS Privacy Done

If you use Platform View, you need to add an additional description for iOS, refer to FAQ-1

6️⃣ Init SDK #

import 'package:flutter/material.dart';
import 'package:zego_express_engine/zego_express_engine.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
    _MyAppState createState() => _MyAppState();

class _MyAppState extends State<MyApp> {
    String version = 'Unknown';

    // Apply AppID and AppSign from ZEGO
    final int appID = 1234567890;

    // Apply AppID and AppSign from ZEGO
    final String appSign = 'abcdefghijklmnopqrstuvwzyv123456789abcdefghijklmnopqrstuvwzyz123';

    // Specify test environment
    final bool isTestEnv = true;

    // Specify a general scenario
    final ZegoScenario scenario = ZegoScenario.General;

    void initState() {

        // Get SDK Version
        ZegoExpressEngine.getVersion().then((ver) {
            setState(() {
              version = ver;

        // Create ZegoExpressEngine
        ZegoExpressEngine.createEngine(appID, appSign, isTestEnv, scenario);

    Widget build(BuildContext context) {
        return MaterialApp(
            home: Scaffold(
                appBar: AppBar(
                    title: const Text('ZegoExpressEngine'),
                body: Center(
                    child: Text('Version: $version\n'),

Please refer to the API documentation for more features.

7️⃣ API documentation #

ZegoExpressEngine API Reference

8️⃣ FAQ #

1. iOS: error when using Platform View: [VERBOSE-2:platform_view_layer.cc(28)] Trying to embed a platform view but the PaintContext does not support embedding #

Open the iOS project that requires Platform View and add the field io.flutter.embedded_views_preview to Info.plist with a value of YES.


2. iOS: fatal error: lipo: -extract armv7 specified but fat file: [...] does not contain that architecture #

Usually occurs when switching iOS devices, which can be resolved by deleting the flutter-project-path/build/ and flutter-project-path/ios/DerivedData/ directories. (If you cannot find the DerivedData folder, please look for /Users/your-user-name/Library/Developer/Xcode/DerivedData/)

3. iOS: Error when compiling: CDN: trunk URL couldn't be downloaded or CDN: trunk Repo update failed #

Open the Terminal terminal cd into the ios folder in the root directory of your project (the directory where the Podfile file is located) and execute pod repo update.

It is usually caused by a poor Internet connection in mainland China. It is recommended to turn on the proxy. Please refer to iOS CocoaPods FAQ

4. Android: building release crashes with NoClassDefFoundError when Flutter is upgraded to v1.10 or above #

Flutter is enabled obfuscation by default in version 1.10 or above. Please add the following line in app/proguard-rules.pro to prevent the SDK obfuscation.

-keep class **.zego.**{*;}

9️⃣ How to contribute #

We welcome contributions, information on how to get started can be found at our contributor guide.

Change Log #

0.11.0 #

  1. Update native SDK to version 1.7.8

  2. Optimize native method handler and callback handler

0.10.0 #

  1. Add media player (audio only) module

  2. Update native SDK to version 1.7.0

  3. Add error code definition class

  4. Fix iOS callback bug

0.9.3 #

  • Fix type conversion issue in dart callback

0.9.2 #

  • Update native SDK version to 1.6.0

0.9.1 #

  1. Implement Android mixer API

  2. Fix iOS mixer bug

0.9.0 #

  • Initial release, with native SDK dependency version 1.5.5


import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zego_express_engine_example/pages/init_sdk_page.dart';
import 'package:zego_express_engine_example/config/zego_config.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'ZegoExpressExample',
      theme: ThemeData(

        primarySwatch: Colors.blue,
      home: HomePage(title: 'ZegoExpressExample'),

class HomePage extends StatelessWidget {
  HomePage({Key key, this.title}) : super(key: key);

  final String title;

  Widget build(BuildContext context) {

    print(ZegoConfig.instance); // Load config instance

    return Scaffold(
        appBar: AppBar(

          title: Text(title),
        body: SafeArea(
            child: Center(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                    padding: const EdgeInsets.only(bottom: 10.0),
                      color: Color(0xff0e88eb),
                      child: Text('Publish Stream'),
                      onPressed: () {
                        Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) {
                          return InitPage(true);
                    padding: const EdgeInsets.only(bottom: 10.0),
                      color: Color(0xff0e88eb),
                      child: Text('   Play Stream   '),
                      onPressed: () {
                        Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) {
                          return InitPage(false);

Use this package as a library

1. Depend on it

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

  zego_express_engine: ^0.11.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:zego_express_engine/zego_express_engine.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 May 23, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.1
  • pana: 0.13.8-dev
  • Flutter: 1.17.0

Health suggestions

Fix lib/src/zego_express_defines.dart. (-0.50 points)

Analysis of lib/src/zego_express_defines.dart reported 1 hint:

line 3 col 8: Unused import: 'zego_express_impl.dart'.

Format lib/src/zego_express_api.dart.

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

Format lib/src/zego_express_api_device.dart.

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

Fix additional 12 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/zego_express_api_im.dart (Run flutter format to format lib/src/zego_express_api_im.dart.)
  • lib/src/zego_express_api_mediaplayer.dart (Run flutter format to format lib/src/zego_express_api_mediaplayer.dart.)
  • lib/src/zego_express_api_mixer.dart (Run flutter format to format lib/src/zego_express_api_mixer.dart.)
  • lib/src/zego_express_api_player.dart (Run flutter format to format lib/src/zego_express_api_player.dart.)
  • lib/src/zego_express_api_preprocess.dart (Run flutter format to format lib/src/zego_express_api_preprocess.dart.)
  • lib/src/zego_express_api_publisher.dart (Run flutter format to format lib/src/zego_express_api_publisher.dart.)
  • lib/src/zego_express_api_room.dart (Run flutter format to format lib/src/zego_express_api_room.dart.)
  • lib/src/zego_express_error_code.dart (Run flutter format to format lib/src/zego_express_error_code.dart.)
  • lib/src/zego_express_impl.dart (Run flutter format to format lib/src/zego_express_impl.dart.)
  • lib/src/zego_express_platform_view_utils.dart (Run flutter format to format lib/src/zego_express_platform_view_utils.dart.)
  • lib/src/zego_express_texture_render_utils.dart (Run flutter format to format lib/src/zego_express_texture_render_utils.dart.)
  • lib/zego_express_engine.dart (Run flutter format to format lib/zego_express_engine.dart.)


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