marigold_mobile_flutter_sdk 0.0.3
marigold_mobile_flutter_sdk: ^0.0.3 copied to clipboard
A wrapper for the Marigold mobile SDKs using Flutter
Marigold Mobile Flutter SDK #
The Marigold Mobile Flutter SDK enables seamless integration of Marigold’s messaging and analytics capabilities into Flutter applications for both Android and iOS platforms. This plugin serves as a bridge between your Flutter app and the native Marigold SDKs.
Installation #
Add the plugin to your pubspec.yaml
:
dependencies:
marigold_mobile_flutter_sdk: <latest_version>
Then run
flutter pub get
iOS Setup #
Follow the steps below to configure the Marigold Flutter SDK on iOS.
1. Set the Minimum iOS Version #
Open your ios/Podfile
and set the platform version to 12.0 or higher:
platform :ios, '12.0'
Then, run:
cd ios
pod install
2. Configure AppDelegate.swift
#
Update your AppDelegate.swift file to initialize the Marigold SDK:
import Marigold
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
let marigold = Marigold()
try! marigold.startEngine("<SDK_KEY>")
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
4. Info.plist Configuration #
Ensure your Info.plist file includes any required configurations (e.g., permissions for push notifications, network access, etc.). Example for network permission:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Android Setup #
Follow these steps to configure the Marigold Flutter SDK in your Android project.
1. Set Minimum SDK Version #
In android/app/build.gradle
, ensure the minimum SDK version is at least 21:
defaultConfig {
minSdkVersion 21
// other settings...
}
2. Add Internet Permission #
Open android/app/src/main/AndroidManifest.xml and add the following line inside the
<uses-permission android:name="android.permission.INTERNET"/>
3. Call startEngine() #
override fun onCreate() {
super.onCreate()
Marigold().startEngine(this, "<SDK_KEY>")
}
4. In order to get push working you'll also need to add the google-services.json. #
Place your google-services.json file in:
android/app/google-services.json
Clean and Build #
After setup, clean and rebuild your project:
flutter clean
flutter pub get
flutter run