Introduction

The Magify Flutter SDK lets you integrate analytics, purchase tracking, ad impression tracking, remote configuration, and content management into your Flutter application.

It gives your Flutter app one Dart API that works the same way on iOS and Android.

Before you begin

Before integrating the SDK, make sure your project meets the following requirements:

  • Flutter 3.44.0 or later
  • Dart SDK 3.12.2 or later
  • iOS 16.0 or later
  • Android API level 24 (Android 7.0) or later

Architecture overview

The main entry point of the SDK is the MagifyClient singleton, reached through MagifyClient.instance.

MagifyClient is responsible for:

  • loading SDK configuration;
  • managing client identity;
  • tracking analytics events, purchases and ad impressions;
  • exposing remote feature flags, stored features and content;
  • reporting attribution and acquisition-cost data;
  • communicating with Magify backend services.

Every call other than init and isInitialized requires init to have completed. Calls are asynchronous (Future/Stream), and failures arrive on the Dart side as MagifyException.

We recommend calling init once, as early as possible during application startup — for example, before runApp, or from the first provider/controller your widget tree depends on. Calling init more than once is safe: later calls await the same underlying initialization and do not create a second client instance.

import 'package:flutter/widgets.dart';
import 'package:magify_flutter_sdk/magify_sdk.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await MagifyClient.instance.init(
    const MagifyConfig(
      applicationName: 'MyApplication',
      defaultConfig: 'assets/magify_default_config.json',
      isSandbox: false,
    ),
  );

  runApp(const MyApp());
}

This keeps a single shared MagifyClient.instance alive for the lifetime of the app and avoids races between widgets that depend on the SDK being ready.

Next step

Now that you understand the SDK architecture, you can proceed to the Installation section to add the Magify Flutter SDK to your project.

Related articles

Advanced

MagifyManager․Lto

Purchases

PurchaserService

Popups

Features Provider