Push SDK for Flutter is a stream ingest toolkit built on top of Push SDK for Android/iOS. This topic describes how to compile the demo of Push SDK for Flutter.
Try the demo
Scan the following QR code to download the demo of the latest version of Push SDK for Flutter.
Demo compilation
Environment requirements
Item | Requirement |
Flutter version | Versions between 2.5.0 and 3.0.0. |
Dart version | Versions between 2.12.0 and 3.0.0. |
OS version | Android 5.0 or later. |
CPU architecture | armeabi-v7a or arm64-v8a. |
Development tool | Android Studio or Visual Studio Code. Note For Android, you can use Android Studio or Visual Studio Code. For iOS, we recommend that you use Visual Studio Code. |
You may experience compatibility issues if you use a different version of Flutter engine. Ensure that your environment meets the preceding requirements. We recommend that you use the following version:
$ flutter --version
Flutter 2.8.0 • channel unknown • unknown source
Framework • revision CF44000065 (16 months ago) 2021-12-08 14:06:50 -0800
Engine • revision 40a99c5951
Tools • Dart 2.15.0
Prerequisites
The source code is downloaded from the SDK download and release notes page. The page provides two options:
Download Push SDK for Flutter (the zip name is flutter_livepush_plugin), which includes the source code for both the Flutter plugin and the demo.
Download demo source code (the zip name is flutter_livepush_demo), which includes only the demo source code. The Flutter plugin is integrated as a YAML dependency.
The following section describes how to compile the source code in flutter_livepush_plugin by using Android Studio and Visual Studio Code.
Use Android Studio
Import the project.
Launch Android Studio, click Open, and select the flutter_livepush_plugin folder.
Run the project.
We recommend that you add the following command at runtime:
--no-sound-null-safety
If you do not add the preceding command, the following error may occur.
Use Visual Studio Code
Import the project.
Launch Visual Studio Code, choose
, and select the flutter_livepush_demo folder.Run the project.
Android:
Navigate to the flutter_livepush_plugin/example directory and run the following commands:
flutter clean flutter pub get flutter pub upgrade
Run the following commands in the terminal:
# Run the debug version. flutter run --debug --no-sound-null-safety # Run the release version. flutter run --release --no-sound-null-safety
iOS:
Navigate to the flutter_livepush_plugin/example directory and run the following commands:
flutter clean flutter pub get flutter pub upgrade
Use one of the following methods to compile and run the project:
Method 1: Run the
flutter run
command directly in the terminal.# Run the debug version. flutter run --debug --no-sound-null-safety # Run the release version. flutter run --release --no-sound-null-safety
Method 2: Install Xcode and run the following command in the flutter_livepush_plugin/example/ios directory. We recommend that you use CocoaPods 1.11.0 or later to avoid compatibility issues with Push SDK for Flutter.
pod install
After the Podfile.lock file and the Pods folder are generated, open Runner.xcworkspace to run the project in Xcode.
NoteIf null safety issues related to fish_redux or fluttertoast occur after you use Method 2, we recommend that you use Method 1 to run the project by running the
flutter run
command. If the command succeeds, run the project in Xcode.