Connect with Flutter
Connect a Flutter app to the native SDKs and verify an Experience on iOS or Android.
The Flutter SDK displays native Nuxie Experiences in your iOS and Android app. Use its Dart client to send events, handle purchases, and update widgets when feature access changes. Requires Flutter 3.41+ and Dart 3.11+.
Installation
Installation
Install the released Flutter package:
flutter pub add nuxie_flutter:^1.0.0For iOS 15+, enable Swift Package Manager:
flutter:
config:
enable-swift-package-manager: trueFor Android API 23+, use Java 21, compile SDK 36, and a FlutterFragmentActivity host. The native Android dependency resolves from Maven Central.
Set your MainActivity to inherit from FlutterFragmentActivity:
import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity : FlutterFragmentActivity()Swift Package Manager resolves the iOS SDK dependency declared by the plugin. See native setup for host requirements and optional native source builds.
Initialize
Initialize
Copy your app’s public keys from Connect your app. Use pk_test_ keys in development builds and pk_live_ keys in release builds. Keep the default service environment for both; the key selects preview or live content.
After WidgetsFlutterBinding.ensureInitialized(), configure Nuxie before runApp:
import 'package:nuxie_flutter/nuxie_flutter.dart';
final nuxie = Nuxie.instance;
await nuxie.configure(const NuxieConfiguration(
apiKeys: NuxieApiKeys(
ios: String.fromEnvironment('NUXIE_IOS_API_KEY'),
android: String.fromEnvironment('NUXIE_ANDROID_API_KEY'),
),
));Place this in your asynchronous main function and handle configuration errors before runApp. Supply the platform keys when running Flutter:
flutter run \
--dart-define=NUXIE_IOS_API_KEY=YOUR_IOS_PUBLIC_KEY \
--dart-define=NUXIE_ANDROID_API_KEY=YOUR_ANDROID_PUBLIC_KEYRun your app on a device or simulator. Connect your app shows Connected after Nuxie receives a request from the SDK.
Trigger an Experience
Trigger an Experience
Publish an Experience for this app with the event trigger integration_test. Set its re-entry rule to Every match if you want to show it repeatedly while integrating. Add this call to a button handler after setup:
await nuxie.trigger('integration_test');Tapping the button sends the event. Nuxie displays the Experience when the customer matches its audience and delivery rules. For an existing Experience, replace integration_test with its published event name.
Connect your app changes to Shown after the SDK reports that the Experience appeared.
Update an Experience
Update an Experience
Edit the Experience and publish your changes. Bring the app back to the foreground to fetch the update, then send the event again with a customer who can re-enter. New Journeys use the updated version; a Journey already in progress keeps the version it started with. The app code stays the same.
See the SDK reference for identity, feature access, and App Actions. Delivery explains trigger and audience configuration.