# Integrate SDKs in Hybrid Flutter and native Apps

We support the integration of SDK components in hybrid Flutter and native applications. You can utilize Flutter widgets on Flutter pages and native components on native pages. SDK global handlers and callbacks are implemented on the native side, so your existing native integration code continues to drive shopping behavior, analytics, and other global events across both Flutter and native pages.

This guide is written for the common case: you have an existing native app with the Firework iOS/Android SDK integrated, and you are adding Flutter pages to it. With this approach, all your existing native SDK integration code (handlers, callbacks, shopping configurations, analytics listeners, etc.) keeps working as-is — you only need to add the Flutter SDK on top.

## Initialization

#### Install SDKs

Since the Flutter SDK depends on the native SDKs, installing the Flutter SDK will automatically install the native SDKs as well. Please use the following code to install the Flutter SDK, after which the native SDKs will also be installed.

```sh
flutter pub add fw_flutter_sdk
```

**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 update FireworkVideo` instead.

#### Configure and initialize native SDKs

Follow the native SDK guides below to configure and initialize the SDK on each platform. The native SDKs are already installed via the Flutter SDK in the previous step, so you can skip the installation sections in these guides.

1. [Getting Started (iOS)](/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/getting-started.md)
2. [Getting Started (Android)](/firework-for-developers/android-sdk/integration-guide/getting-started.md)

#### Call markInitCalled in Dart side

As shown in the following code snippets, we need to invoke `markInitCalled` with `directlyCallNativeInit` set to `true` on the Dart side.

```dart
FireworkSDK.getInstance().markInitCalled(directlyCallNativeInit: true);
```

## Use Flutter widgets

You can utilize Flutter widgets on the Flutter page. Please consult the following docs for further details:

1. [Video Feed (Flutter)](/firework-for-developers/flutter-sdk/integration-guide-v2/video-feed.md)
2. [Story Block (Flutter)](/firework-for-developers/flutter-sdk/integration-guide-v2/story-block.md)

## Use native components

You can utilize native components on the native page. Please consult the following docs for further details:

1. [Video Feed (iOS)](/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/video-feed.md)
2. [Story Block (iOS)](/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/storyblock.md)
3. [Video Feed (Android)](https://github.com/loopsocial/gitbook-docs/blob/master/android-sdk/integration-guide/video-feed/README.md)
4. [StoryBlock (Android)](/firework-for-developers/android-sdk/integration-guide/storyblock.md)

## Analytics

Receive analytics events on the **native side**. Please consult the following docs for further details:

1. [Analytics (iOS)](/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/analytics.md)
2. [Analytics (Android)](/firework-for-developers/android-sdk/integration-guide/analytics.md)

## Shopping

Customize shopping configurations and click behaviors on the **native side**. Please consult the following docs for further details:

1. [Shopping (iOS)](/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/shopping-ios.md)
2. [Shoppable Videos (Android)](/firework-for-developers/android-sdk/integration-guide/shoppable-videos.md)

## Live Stream Support

To enable support for livestream, please consult the following docs:

1. [Live Stream Support (iOS)](/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/live-stream-support.md)
2. [Live Stream Support (Android)](https://github.com/loopsocial/gitbook-docs/blob/master/android-sdk/integration-guide/live-stream-support-android.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.firework.com/firework-for-developers/flutter-sdk/integration-guide-v2/integrate-sdks-in-hybrid-flutter-and-native-apps.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
