For the complete documentation index, see llms.txt. This page is also available as Markdown.

Getting Started (Flutter)

Latest version release notes

Prerequisites

  • Firework App Id

  • Flutter SDK >=3.0.0

  • Dart SDK >=2.17.0

  • iOS project

    • iOS 13 or greater.

    • Xcode 14 or greater.

    • Swift 5.7 or greater.

  • Android Project

    • JAVA_HOME 1.8 or greater

    • minSdkVersion 21 or greater

    • compileSdkVersion 31 or greater

    • targetSdkVersion 31 or greater

    • kotlinVersion 1.8.0 or greater

Installation

Installing Firework Flutter SDK requires the following step:

  1. Install Flutter plugin package

  2. Setup Native project

Install Flutter plugin Package

Setup Native Project

iOS

Run pod install in the root directory of the iOS project. If you encounter the error CocoaPods could not find compatible versions for pod "FireworkVideo", run pod repo update && pod update FireworkVideo instead.

Android

  • build.gradle

  • gradle-wrapper.properties

  • app/src/.../MainActivity.kt

The MainActivity should extend FlutterFragmentActivity.

  • app/build.gradle

  • add android:windowSoftInputMode="adjustPan" to the file app/src/Androidmanifest.xml if there is a story block in your app and use the live stream

  • New file: app/firework.gradle

App Id Configuration

iOS

Include the app ID in your app Info.plist file using the key FireworkVideoAppID .

See the image below:

Android

Include the appid in your app AndroidManifest.xml file, like below:

SDK Initialization

iOS

Import fw_flutter_sdk and call FWFlutterSDK.initializeSDK() in application(:, didFinishLaunchingWithOptions:) -> Bool

iOS initialization options

We support passing an option to the SDK initialization method. The sample codes are:

The SDK init option structure is:

Android

Step 1: Add the FWFlutterSDK.init(this) method to your FlutterApplication class.

Android initialization options

We support passing an option to the SDK initialization method. The sample codes are:

The SDK init option structure is:

Step 2: Please check the Inject Image Loader section. Choose an image loader(Glide or Picasso) that works for you. If you're not sure which one to use, Glide image loader is recommended.

Dart

Call FireworkSDK.getInstance().markInitCalled() on the Dart side.

Read SDK State

After the SDK is initialized, the host app can read the following SDK state from Dart. Both iOS and Android are supported.

Getter
Type
Description

FireworkSDK.getInstance().appId

String?

The current app id (client id). Returns null when there is no value.

FireworkSDK.getInstance().guestId

String?

The current guest id (visitor id). Returns null when there is no value, e.g. before the SDK is initialized.

FireworkSDK.getInstance().isPipShown

bool

Whether the SDK is currently showing the picture-in-picture player. Defaults to false.

The values are pushed from the native SDK to Dart, so read them after the SDK initialization succeeds (for example inside the onSDKInit callback). appId and guestId stay stable after initialization, while isPipShown changes as the picture-in-picture player is shown or dismissed.

Next

ATT compliance

Please refer to ATT compliance Flutter (iOS).

Video Feed

If you want to integrate the video feed, please follow the instruction here.

Story Block

If you want to integrate the story block, please follow the instruction here.

Customization

If you want to customize SDK, please refer to Customization.

Live stream support

If you want to integrate the live stream, please follow the instruction here.

Shopping

If you want to integrate video shopping, please follow the instruction here.

Analytics

If you want to integrate video shopping, please follow the instruction here.

Sample Project

We provide a sample project on Github.

Last updated

Was this helpful?