For the complete documentation index, see llms.txt. This page is also available as Markdown.

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 21 (5.0 LOLLIPOP) and above

  • iOS 13 and above

OS Support by Flutter SDK Version
Hackle Flutter SDK Version
Supported OS

Below 2.29.0

  • Android API 16 and above

  • iOS 10 and above

2.29.0 and above, below 2.32.0

  • Android API 16 and above

  • iOS 13 and above

2.32.0 and above

  • Android API 21 and above

  • iOS 13 and above

Add SDK Dependency

Add the SDK dependency.

flutter pub add hackle
dependencies:
	hackle: ^2.7.0

SDK Initialization

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

  • HackleApp is 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.

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.

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.

Last updated