Flutter SDK Installation
Follow these steps to add the Magify Flutter SDK to your project.
Requirements
Adding the package
Place magify_flutter_sdk somewhere inside your project (for example into a top-level
packages/ directory) and add it as a local path dependency in your app's
pubspec.yaml:
dependencies:
magify_flutter_sdk:
path: packages/magify_flutter_sdk
Then fetch it:
flutter pub get
No further native setup (Podfile entries, Gradle dependencies, manifest changes) is required — the plugin registers itself on both platforms automatically.
Adding the configuration file(s)
The SDK requires a configuration file for your application, one per platform (they may be the same file if both platforms share an application entry).
- Download the configuration file(s) for your application(s).
- Place them under your Flutter app's
assets/directory, for example:assets/magify_default_config.json - Declare the asset in
pubspec.yaml:flutter: assets: - assets/magify_default_config.json
If iOS and Android use different Magify applications (and therefore different config
files), declare both assets and pass them separately through MagifyConfig.ios.defaultConfig
and MagifyConfig.android.defaultConfig (see Configuration options).
Dummy configuration example
If you need a temporary configuration file for local testing, you can use the following example:
{
"limits": {
"impression_per_session_limit": null,
"interstitials_per_session_limit": null,
"sessions_interval": null,
"global_interval": null,
"interstitial_interval": null,
"required_campaign_types": []
},
"native_elements": [],
"campaigns": [],
"features": {},
"content": {}
}
SDK initialization
Call MagifyClient.instance.init once during app startup:
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());
}
See SDK Initialization for the full set of options, including per-platform overrides.
Releases
See the Releases page for the SDK version history and release notes.
Next step
Now that the SDK is installed, you can proceed to the Configuration section to customize the SDK behavior for your application.