All Products
Search
Document Center

:Run the source code of the demo of Push SDK for Flutter

Last Updated:Jan 21, 2025

This topic describes how to compile the demo of Push SDK for Flutter.

Environment requirements

Item

Description

Flutter version

Versions equal to or later than 2.5.0 and earlier than 3.0.0 are supported.

Dart version

Versions equal to or later than 2.12.0 and earlier than 3.0.0 are supported.

OS version

Android 5.0 and later are supported.

CPU architecture

armeabi-v7a and arm64-v8a are supported.

Development tool

We recommend that you use 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.

Use Android Studio

  1. Download the demo package of Push SDK for Flutter of the required version. For information about the download link, see Select and download SDKs.

  2. Import the project.

    Open Android Studio, click Open, and then select the flutter_livepush_demo project.

    image.pngimage.png

  3. Run the project.

    When you run the project, we recommend that you add the following argument:

    --no-sound-null-safety

    image.png

    If you do not add the preceding argument, the following error may occur.

    image.png

Use Visual Studio Code

  1. Import the project.

    Open Visual Studio Code, choose File > Open, and then select the flutter_livepush_demo project.

    image.pngimage.png

  2. Run the project.

    • Android:

      1. Run the following commands in the flutter_livepush_demo directory:

        flutter clean
        flutter pub get
        flutter pub upgrade
      2. 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:

      1. Run the following commands in the flutter_livepush_demo directory:

        flutter clean
        flutter pub get
        flutter pub upgrade
      2. Use one of the following methods to compile and run the project:

        • Method 1: Run the flutter run command 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_demo/ios directory. We recommend that you use CocoaPods 1.11.0 or later to ensure that Push SDK for Flutter is run as expected.

          pod install

          After the Podfile.lock file and the Pods folder are generated, open Runner.xcworkspace to run the project in Xcode.

          Note

          If 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 using the flutter run command. If the command succeeds, run the project in Xcode.