Flutter
Hackle Flutter SDK supports Flutter SDK 2.0.0 and above.
Flutter SDK is built on top of Android SDK and iOS SDK. The following OS versions are supported.
Android API 16 (4.1 Jelly Bean) and above
iOS 13 and above
Starting from Hackle Flutter SDK 2.29.0, the minimum supported iOS version has been raised to iOS 13.
For versions below Hackle Flutter SDK 2.29.0, the minimum supported iOS version is iOS 10.
Add SDK Dependency
Add the SDK dependency.
flutter pub add hackledependencies:
hackle: ^2.7.0After installing or updating the SDK, you must rebuild the app for the integration changes to take effect.
SDK Initialization
You must initialize HackleApp before using the SDK. An SDK Key is required to initialize HackleApp.
HackleAppis a class that provides methods for using the SDK features.You can find the SDK Key in SDK Integration Info on the Hackle Service Dashboard.
During initialization, the SDK fetches required information from the Hackle server and stores it locally.
Initialization runs asynchronously, and you can use await to wait until initialization is complete.
If you call A/B Test or Feature Flag methods before initialization completes, they will return the default group (A) or off (false).
Recommended Initialization Strategy: Initialize via Splash Screen
Instead of launching the app immediately, display a splash screen while the SDK initializes. Once initialization completes, use a callback to close the splash screen and allow users to interact with the app.
Inject User on Initialization
You can initialize the SDK with user information included.
If no user information is provided, the SDK uses user information stored in local storage.
If user information is provided, the SDK does not use information stored in local storage.
If no user is injected and no user information is stored in local storage, the SDK uses a user with the Hackle Device ID as the device ID.
User information can be freely updated after SDK initialization using the user info setter functions.
User information injected during initialization is not merged with user information stored in local storage.
ex) If userId: A is stored in storage and you inject deviceId: B during initialization, the user will be set to userId: null, deviceId: B.
SDK Initialization Config
You can add several configuration options when initializing the SDK.
exposureEventDedupIntervalMillis
Removes duplicate exposure events for the same A/B Test or Feature Flag distribution result triggered consecutively by the same user.
Min value: 1000 (1 second)
Max value: 3600000 (1 hour)
-1 (no deduplication)
All versions
debug
Outputs logs for all features to the console and sends events immediately.
false
2.1.0+
pollingIntervalMillis
Periodically updates settings configured in the Dashboard.
Min value: 60000 (60 seconds)
-1 (no periodic update)
2.3.0+
automaticScreenTracking
Detects Activity / ViewController changes at the Android / iOS level to track screen transitions.
true
2.21.0+
sessionPolicy
Configures session persistence and expiry conditions.
ALWAYS_NEW_SESSION ,
1800000
2.30.0+
optOutTracking
Whether Opt-out is enabled.
false
2.30.0+
sessionTimeoutMillis (deprecated)
Sets the session timeout duration. Please use sessionPolicy instead.
1800000 (30 minutes)
2.9.0+
Session Policy Configuration
You can control session persistence and expiry conditions by configuring the session policy.
Refresh Dashboard Config
You can explicitly refresh the Dashboard configuration.
This function can be called at most once every 60 seconds.
Last updated