appdna_sdk Flutter package.
AppDNA Class
TheAppDNA class is the primary entry point for all SDK functionality. All methods are static.
Core Methods
| Method | Signature | Returns | Description |
|---|---|---|---|
configure | configure(String apiKey, {AppDNAEnvironment? environment, AppDNAOptions? options}) | Future<void> | Initialize the SDK with your API key |
identify | identify(String userId, {Map<String, dynamic>? traits}) | Future<void> | Associate events with a user identity |
reset | reset() | Future<void> | Clear user identity and generate a new anonymous ID |
track | track(String event, {Map<String, dynamic>? properties}) | Future<void> | Track a named event with optional properties |
flush | flush() | Future<void> | Force flush all queued events |
onReady | onReady() | Future<void> | Wait for remote config to load |
shutdown | shutdown() | Future<void> | Shut down the SDK and release resources |
setLogLevel | setLogLevel(String level) | void | Change log verbosity at runtime |
setConsent | setConsent(bool granted) | Future<void> | Set user analytics consent |
getSdkVersion | getSdkVersion() | Future<String> | Get the current SDK version string |
Remote Config Methods
| Method | Signature | Returns | Description |
|---|---|---|---|
getRemoteConfig | getRemoteConfig(String key) | Future<dynamic> | Get a remote config value by key |
isFeatureEnabled | isFeatureEnabled(String flag) | Future<bool> | Check if a feature flag is enabled |
Experiment Methods
| Method | Signature | Returns | Description |
|---|---|---|---|
getExperimentVariant | getExperimentVariant(String experimentId) | Future<String?> | Get the assigned variant for an experiment |
isInVariant | isInVariant(String experimentId, String variantId) | Future<bool> | Check if the user is in a specific variant |
getExperimentConfig | getExperimentConfig(String experimentId, String key) | Future<dynamic> | Get a config value for a specific experiment variant |
Push Methods (Static)
| Method | Signature | Returns | Description |
|---|---|---|---|
setPushToken | setPushToken(String token) | Future<void> | Register a push notification token |
setPushPermission | setPushPermission(bool granted) | Future<void> | Update push permission status |
trackPushDelivered | trackPushDelivered(String pushId) | Future<void> | Track push notification delivery |
trackPushTapped | trackPushTapped(String pushId, {String? action}) | Future<void> | Track push notification tap |
Presentation Methods
| Method | Signature | Returns | Description |
|---|---|---|---|
presentOnboarding | presentOnboarding(String flowId) | Future<void> | Present an onboarding flow |
presentPaywall | presentPaywall(String paywallId, {PaywallContext? context}) | Future<void> | Present a paywall |
Web Entitlement
| Method | Signature | Returns | Description |
|---|---|---|---|
webEntitlement | webEntitlement (getter) | Future<WebEntitlement?> | Get the current web entitlement |
onWebEntitlementChanged | onWebEntitlementChanged (getter) | Stream<WebEntitlement?> | Stream of web entitlement changes |
Deep Links
| Method | Signature | Returns | Description |
|---|---|---|---|
checkDeferredDeepLink | checkDeferredDeepLink() | Future<DeferredDeepLink?> | Check for a deferred deep link |
Module Namespaces
TheAppDNA class exposes module-specific functionality through namespace accessors:
| Accessor | Type | Description |
|---|---|---|
AppDNA.push | AppDNAPushModule | Push notification management |
AppDNA.onboarding | AppDNAOnboardingModule | Server-driven onboarding flows |
AppDNA.paywall | AppDNAPaywallModule | Server-driven paywalls |
AppDNA.remoteConfig | AppDNARemoteConfigModule | Remote configuration access |
AppDNA.features | AppDNAFeaturesModule | Feature flag evaluation |
AppDNA.experiments | AppDNAExperimentsModule | Experiment variant management |
AppDNA.inAppMessages | AppDNAInAppMessagesModule | In-app message presentation |
AppDNA.surveys | AppDNASurveysModule | Survey presentation and collection |
AppDNA.deepLinks | AppDNADeepLinksModule | Deep link handling |
AppDNA.billing | AppDNABilling | Billing and purchase management |
AppDNAPushModule
| Method | Signature | Returns | Description |
|---|---|---|---|
setToken | setToken(String token) | Future<void> | Register a push token |
setPermission | setPermission(bool granted) | Future<void> | Update push permission status |
trackDelivered | trackDelivered(String pushId) | Future<void> | Track push delivery |
trackTapped | trackTapped(String pushId, {String? action}) | Future<void> | Track push tap with optional action |
requestPermission | requestPermission() | Future<bool> | Request push notification permission |
getToken | getToken() | Future<String?> | Get the current push token |
setDelegate | setDelegate(AppDNAPushDelegate delegate) | void | Set the push delegate |
AppDNABilling
| Method | Signature | Returns | Description |
|---|---|---|---|
purchase | purchase(String productId, {String? offerToken}) | Future<PurchaseResult> | Initiate a purchase |
restorePurchases | restorePurchases() | Future<List<Entitlement>> | Restore previous purchases |
getProducts | getProducts(List<String> productIds) | Future<List<ProductInfo>> | Fetch product information |
hasActiveSubscription | hasActiveSubscription() | Future<bool> | Check for active subscription |
getEntitlements | getEntitlements() | Future<List<Entitlement>> | Get all current entitlements |
onEntitlementsChanged | onEntitlementsChanged (getter) | Stream<List<Entitlement>> | Stream of entitlement changes |
onEntitlementsChangedCallback | onEntitlementsChangedCallback(Function(List<Entitlement>) callback) | void | Register entitlement change callback |
AppDNAOnboardingModule
| Method | Signature | Returns | Description |
|---|---|---|---|
present | present(String flowId, {OnboardingContext? context}) | Future<void> | Present an onboarding flow |
setDelegate | setDelegate(AppDNAOnboardingDelegate delegate) | void | Set the onboarding delegate |
AppDNAPaywallModule
| Method | Signature | Returns | Description |
|---|---|---|---|
present | present(String paywallId, {PaywallContext? context}) | Future<void> | Present a paywall |
setDelegate | setDelegate(AppDNAPaywallDelegate delegate) | void | Set the paywall delegate |
Delegate Abstract Classes
AppDNAPushDelegate
AppDNABillingDelegate
AppDNAOnboardingDelegate
AppDNAPaywallDelegate
Types
AppDNAOptions
| Property | Type | Default | Description |
|---|---|---|---|
flushInterval | int? | 30 | Seconds between automatic event flushes |
batchSize | int? | 20 | Number of events per batch |
configTTL | int? | 300 | Seconds before cached config is stale |
logLevel | AppDNALogLevel? | AppDNALogLevel.warning | Console log verbosity |
billingProvider | AppDNABillingProvider? | AppDNABillingProvider.storeKit2 | Billing integration |
AppDNAEnvironment
| Value | Description |
|---|---|
production | Production API and configuration |
staging | Staging API for testing |
AppDNALogLevel
| Value | Description |
|---|---|
none | No logging |
error | Errors only |
warning | Errors and warnings |
info | Errors, warnings, and info |
debug | All messages including debug |
AppDNABillingProvider
| Value | Description |
|---|---|
storeKit2 | Native StoreKit 2 (default, iOS only) |
revenueCat | RevenueCat integration |
none | Disable billing module |
PaywallContext
| Property | Type | Description |
|---|---|---|
placement | String? | Where the paywall was triggered |
customData | Map<String, dynamic>? | Custom data for paywall personalization |
OnboardingContext
| Property | Type | Description |
|---|---|---|
source | String? | How the flow was triggered |
campaign | String? | Campaign identifier for attribution |
referrer | String? | Referrer identifier |
userProperties | Map<String, dynamic>? | Custom user properties for personalization |
experimentOverrides | Map<String, String>? | Override experiment variants for testing |
PushPayload
| Property | Type | Description |
|---|---|---|
pushId | String | Unique notification identifier |
title | String | Notification title |
body | String | Notification body text |
imageUrl | String? | Rich notification image URL |
data | Map<String, dynamic>? | Custom data payload |
actionType | String? | Action type (e.g., “deep_link”, “url”) |
actionValue | String? | Action value (e.g., URL or screen ID) |
Entitlement
| Property | Type | Description |
|---|---|---|
productId | String | The product identifier |
store | String | The store that granted the entitlement |
status | String | Entitlement status (e.g., “active”, “expired”) |
expiresAt | String? | ISO 8601 expiration date |
isTrial | bool | Whether from a free trial |
offerType | String? | Applied offer type (e.g., “introductory”) |
PurchaseResult
| Property | Type | Description |
|---|---|---|
status | String | One of: purchased, cancelled, pending, unknown |
entitlement | Entitlement? | Entitlement granted by the purchase |
ProductInfo
| Property | Type | Description |
|---|---|---|
id | String | Product identifier |
name | String | Localized product name |
description | String | Localized product description |
displayPrice | String | Formatted price string |
price | double | Numeric price value |
offerToken | String? | Platform-specific offer token (Android) |
WebEntitlement
| Property | Type | Description |
|---|---|---|
productId | String | The product identifier |
status | String | Entitlement status |
expiresAt | String? | ISO 8601 expiration date |
DeferredDeepLink
| Property | Type | Description |
|---|---|---|
url | String | The deep link URL |
params | Map<String, dynamic>? | Parsed URL parameters |
SurveyResult
| Property | Type | Description |
|---|---|---|
surveyId | String | The survey identifier |
answers | List<SurveyAnswer> | Collected answers |
SurveyAnswer
| Property | Type | Description |
|---|---|---|
questionId | String | The question identifier |
value | dynamic | The answer value |