Agora Flutter Quickstart
This tutorial describes how to create an Agora account and build a sample app with Agora using Flutter.
Prerequisites
- Agora.io Developer Account
- Flutter 1.0.0
Quick Start
This repository shows you how to use Agora Flutter SDK to build a simple video call app. It demonstrates you how to:
- Join / leave a channel
- Mute / unmute audio
- Switch camera views
- Layout multiple video views
Create an Account and Obtain an App ID
To build and run the sample application, first obtain an app ID:
- Create a developer account at agora.io. Once you finish the sign-up process, you are redirected to the dashboard.
- Navigate in the dashboard tree on the left to Projects > Project List.
- Copy the app ID that you obtain from the dashboard into a text file. You will use this when you launch the app.
Update and Run the Sample Application
Open the settings.dart file and add the app ID.
const APP_ID = "";
Run the packages get
command in your project directory:
# install dependencies flutter pub get
Once the build is complete, run the run
command to start the app.
# start app flutter run
We recommend you to use IDE to control overall build process during development
Details about how to set up the IDE please take a look at here
Error handling
iOS memory leak
if your flutter channel is stable, PlatformView
will cause memory leak, you can run flutter channel beta
you can refer to this pull request
Android Black screen
Tips: please make sure your all configurations are correct, but still black screen
if your MainActivity extends io.flutter.embedding.android.FlutterActivity
and override the configureFlutterEngine
function
please don’t forget add super.configureFlutterEngine(flutterEngine)
please don’t add GeneratedPluginRegistrant.registerWith(flutterEngine)
, plugins will be registered auto now
you can refer to official documents
Android Release crash
it causes by code obfuscation because of flutter set android.enableR8=true
by the default
Add the following line in the app/proguard-rules.pro file to prevent code obfuscation:
-keep class io.agora.**{*;}
Reporting an issue
Please ensure you provide following information when you report an issue,
Environment
Flutter Doctor
run flutter doctor
and copy the log output.
Agora SDK Logs
Insert below code
AgoraRtcEngine.setParameters("{\"rtc.log_filter\": 65535}");
to call.dart
The eventual outcome would look like this,
... _initAgoraRtcEngine(); _addAgoraEventHandlers(); AgoraRtcEngine.enableWebSdkInteroperability(true); AgoraRtcEngine.setParameters('{\"che.video.lowBitRateStreamParameter\":{\"width\":320,\"height\":180,\"frameRate\":15,\"bitRate\":140}}'); AgoraRtcEngine.setParameters("{\"rtc.log_filter\": 65535}"); AgoraRtcEngine.joinChannel(null, widget.channelName, null, 0); ...
and then start the app. Our sdk log will print directly to console in this case.
Resources
- Complete API documentation at the Developer Center
- File bugs about this sample
- Flutter lab: Write your first Flutter app
- Flutter cookbook: Useful Flutter samples
- Flutter online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
Download Quickstart for Agora Flutter SDK source code on GitHub
https://github.com/AgoraIO-Community/Agora-Flutter-Quickstart
Provides the list of the opensource Flutter apps collection with GitHub repository.