Skip to main content
Version: 6.x.x

Getting Started

This section provides a comprehensive guide on integrating the BlueStack Flutter Plugin into your project. It guides you through the process of adding the BlueStack Flutter Plugin to your project.

BlueStack SDK Flutter plugin provides functionalities for monetizing your mobile application: from premium sales with rich media, video and innovative formats, it facilitates all standard display formats. BlueStack SDK Flutter plugin can be used for iOS and Android Apps.

Prerequisites

RequirementMinimum
Flutter3.3.0 or higher
AndroidminSdk 23+, compileSdk 36+, JDK 17+, AndroidX
iOS13.0+, Xcode 16.0+

Plugin Integration

Installation

Add the plugin to your pubspec.yaml:

pubspec.yaml
dependencies:
bluestack_sdk_flutter: ^6.0.0

Import sdk component

import 'package:bluestack_sdk_flutter/bluestack_sdk_flutter.dart';

SDK Implementation

Initialize the SDK in your application

You need to initialize SDK using the App Id (depends on the platform), before you request any kind of ads. You need to call initialize method of BlueStackInitializer with your appId to initialize the SDK. You can also set the 2nd parameter (optional) enableDebug to true, if you want to enable debug option. By default enableDebug is false.

info

You have to register your app in BlueStack console to get an App Id for your app.

Here's an example of how to initialize the SDK:

void main() async {
// Initialize the SDK
await BlueStackInitializer.initialize(
appId: "YOUR_APP_ID",
enableDebug: true, // Set to false for production
);

runApp(MyApp());
}

Register listeners for SDK initialization callbacks

warning

You must set the listener callbacks before calling the initialize method; otherwise, you may not receive them.

BlueStackInitializer exposes the following events through its lifecycle.

EventsDefinition
onInitializationSuccessThe SDK has been successfully initialized with adapterStatus
onInitializationFailThe SDK failed to initialize with error

Here's an example of how to register event listeners for SDK initialization:

BlueStackInitializer.setEventListener(InitializationEventListener(
onInitializationSuccess: (adapterStatus) {
print('BlueStack SDK has been successfully initialized');
},
onInitializationFail: (error) {
print('BlueStack SDK failed to initialize: ${error.toString()}');
},
));