Flutter

circle-info

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

circle-info

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

arrow-up-right

Add the SDK dependency.

flutter pub add hackle
circle-exclamation

SDK Initialization

You must initialize HackleApp before using the SDK. An SDK Key is required to initialize HackleApp.

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.

circle-exclamation

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.

circle-info

User information can be freely updated after SDK initialization using the user info setter functions.

circle-exclamation

SDK Initialization Config

You can add several configuration options when initializing the SDK.

Config
Description
Default
Supported Version

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.

circle-exclamation

Last updated