Skip to main content
Complete reference for all public methods, modules, delegates, and types in the appdna_sdk Flutter package.

AppDNA Class

The AppDNA class is the primary entry point for all SDK functionality. All methods are static.

Core Methods

MethodSignatureReturnsDescription
configureconfigure(String apiKey, {AppDNAEnvironment? environment, AppDNAOptions? options})Future<void>Initialize the SDK with your API key
identifyidentify(String userId, {Map<String, dynamic>? traits})Future<void>Associate events with a user identity
resetreset()Future<void>Clear user identity and generate a new anonymous ID
tracktrack(String event, {Map<String, dynamic>? properties})Future<void>Track a named event with optional properties
flushflush()Future<void>Force flush all queued events
onReadyonReady()Future<void>Wait for remote config to load
shutdownshutdown()Future<void>Shut down the SDK and release resources
setLogLevelsetLogLevel(String level)voidChange log verbosity at runtime
setConsentsetConsent(bool granted)Future<void>Set user analytics consent
getSdkVersiongetSdkVersion()Future<String>Get the current SDK version string

Remote Config Methods

MethodSignatureReturnsDescription
getRemoteConfiggetRemoteConfig(String key)Future<dynamic>Get a remote config value by key
isFeatureEnabledisFeatureEnabled(String flag)Future<bool>Check if a feature flag is enabled

Experiment Methods

MethodSignatureReturnsDescription
getExperimentVariantgetExperimentVariant(String experimentId)Future<String?>Get the assigned variant for an experiment
isInVariantisInVariant(String experimentId, String variantId)Future<bool>Check if the user is in a specific variant
getExperimentConfiggetExperimentConfig(String experimentId, String key)Future<dynamic>Get a config value for a specific experiment variant

Push Methods (Static)

MethodSignatureReturnsDescription
setPushTokensetPushToken(String token)Future<void>Register a push notification token
setPushPermissionsetPushPermission(bool granted)Future<void>Update push permission status
trackPushDeliveredtrackPushDelivered(String pushId)Future<void>Track push notification delivery
trackPushTappedtrackPushTapped(String pushId, {String? action})Future<void>Track push notification tap

Presentation Methods

MethodSignatureReturnsDescription
presentOnboardingpresentOnboarding(String flowId)Future<void>Present an onboarding flow
presentPaywallpresentPaywall(String paywallId, {PaywallContext? context})Future<void>Present a paywall

Web Entitlement

MethodSignatureReturnsDescription
webEntitlementwebEntitlement (getter)Future<WebEntitlement?>Get the current web entitlement
onWebEntitlementChangedonWebEntitlementChanged (getter)Stream<WebEntitlement?>Stream of web entitlement changes
MethodSignatureReturnsDescription
checkDeferredDeepLinkcheckDeferredDeepLink()Future<DeferredDeepLink?>Check for a deferred deep link

Module Namespaces

The AppDNA class exposes module-specific functionality through namespace accessors:
AccessorTypeDescription
AppDNA.pushAppDNAPushModulePush notification management
AppDNA.onboardingAppDNAOnboardingModuleServer-driven onboarding flows
AppDNA.paywallAppDNAPaywallModuleServer-driven paywalls
AppDNA.remoteConfigAppDNARemoteConfigModuleRemote configuration access
AppDNA.featuresAppDNAFeaturesModuleFeature flag evaluation
AppDNA.experimentsAppDNAExperimentsModuleExperiment variant management
AppDNA.inAppMessagesAppDNAInAppMessagesModuleIn-app message presentation
AppDNA.surveysAppDNASurveysModuleSurvey presentation and collection
AppDNA.deepLinksAppDNADeepLinksModuleDeep link handling
AppDNA.billingAppDNABillingBilling and purchase management

AppDNAPushModule

MethodSignatureReturnsDescription
setTokensetToken(String token)Future<void>Register a push token
setPermissionsetPermission(bool granted)Future<void>Update push permission status
trackDeliveredtrackDelivered(String pushId)Future<void>Track push delivery
trackTappedtrackTapped(String pushId, {String? action})Future<void>Track push tap with optional action
requestPermissionrequestPermission()Future<bool>Request push notification permission
getTokengetToken()Future<String?>Get the current push token
setDelegatesetDelegate(AppDNAPushDelegate delegate)voidSet the push delegate

AppDNABilling

MethodSignatureReturnsDescription
purchasepurchase(String productId, {String? offerToken})Future<PurchaseResult>Initiate a purchase
restorePurchasesrestorePurchases()Future<List<Entitlement>>Restore previous purchases
getProductsgetProducts(List<String> productIds)Future<List<ProductInfo>>Fetch product information
hasActiveSubscriptionhasActiveSubscription()Future<bool>Check for active subscription
getEntitlementsgetEntitlements()Future<List<Entitlement>>Get all current entitlements
onEntitlementsChangedonEntitlementsChanged (getter)Stream<List<Entitlement>>Stream of entitlement changes
onEntitlementsChangedCallbackonEntitlementsChangedCallback(Function(List<Entitlement>) callback)voidRegister entitlement change callback

AppDNAOnboardingModule

MethodSignatureReturnsDescription
presentpresent(String flowId, {OnboardingContext? context})Future<void>Present an onboarding flow
setDelegatesetDelegate(AppDNAOnboardingDelegate delegate)voidSet the onboarding delegate

AppDNAPaywallModule

MethodSignatureReturnsDescription
presentpresent(String paywallId, {PaywallContext? context})Future<void>Present a paywall
setDelegatesetDelegate(AppDNAPaywallDelegate delegate)voidSet the paywall delegate

Delegate Abstract Classes

AppDNAPushDelegate

abstract class AppDNAPushDelegate {
  void onPushTokenRegistered(String token);
  void onPushReceived(Map<String, dynamic> notification, bool inForeground);
  void onPushTapped(Map<String, dynamic> notification, String? actionId);
}

AppDNABillingDelegate

abstract class AppDNABillingDelegate {
  void onPurchaseCompleted(String productId, Map<String, dynamic> transaction);
  void onPurchaseFailed(String productId, String error);
  void onEntitlementsChanged(List<Entitlement> entitlements);
  void onRestoreCompleted(List<String> restoredProducts);
}

AppDNAOnboardingDelegate

abstract class AppDNAOnboardingDelegate {
  void onOnboardingStarted(String flowId);
  void onOnboardingStepChanged(
    String flowId,
    String stepId,
    int stepIndex,
    int totalSteps,
  );
  void onOnboardingCompleted(
    String flowId,
    Map<String, dynamic> responses,
  );
  void onOnboardingDismissed(String flowId, int atStep);
}

AppDNAPaywallDelegate

abstract class AppDNAPaywallDelegate {
  void onPaywallPresented(String paywallId);
  void onPaywallAction(String paywallId, String action);
  void onPaywallPurchaseStarted(String paywallId, String productId);
  void onPaywallPurchaseCompleted(
    String paywallId,
    String productId,
    Map<String, dynamic> transaction,
  );
  void onPaywallPurchaseFailed(String paywallId, String error);
  void onPaywallDismissed(String paywallId);
}

Types

AppDNAOptions

PropertyTypeDefaultDescription
flushIntervalint?30Seconds between automatic event flushes
batchSizeint?20Number of events per batch
configTTLint?300Seconds before cached config is stale
logLevelAppDNALogLevel?AppDNALogLevel.warningConsole log verbosity
billingProviderAppDNABillingProvider?AppDNABillingProvider.storeKit2Billing integration

AppDNAEnvironment

ValueDescription
productionProduction API and configuration
stagingStaging API for testing

AppDNALogLevel

ValueDescription
noneNo logging
errorErrors only
warningErrors and warnings
infoErrors, warnings, and info
debugAll messages including debug

AppDNABillingProvider

ValueDescription
storeKit2Native StoreKit 2 (default, iOS only)
revenueCatRevenueCat integration
noneDisable billing module

PaywallContext

PropertyTypeDescription
placementString?Where the paywall was triggered
customDataMap<String, dynamic>?Custom data for paywall personalization

OnboardingContext

PropertyTypeDescription
sourceString?How the flow was triggered
campaignString?Campaign identifier for attribution
referrerString?Referrer identifier
userPropertiesMap<String, dynamic>?Custom user properties for personalization
experimentOverridesMap<String, String>?Override experiment variants for testing

PushPayload

PropertyTypeDescription
pushIdStringUnique notification identifier
titleStringNotification title
bodyStringNotification body text
imageUrlString?Rich notification image URL
dataMap<String, dynamic>?Custom data payload
actionTypeString?Action type (e.g., “deep_link”, “url”)
actionValueString?Action value (e.g., URL or screen ID)

Entitlement

PropertyTypeDescription
productIdStringThe product identifier
storeStringThe store that granted the entitlement
statusStringEntitlement status (e.g., “active”, “expired”)
expiresAtString?ISO 8601 expiration date
isTrialboolWhether from a free trial
offerTypeString?Applied offer type (e.g., “introductory”)

PurchaseResult

PropertyTypeDescription
statusStringOne of: purchased, cancelled, pending, unknown
entitlementEntitlement?Entitlement granted by the purchase

ProductInfo

PropertyTypeDescription
idStringProduct identifier
nameStringLocalized product name
descriptionStringLocalized product description
displayPriceStringFormatted price string
pricedoubleNumeric price value
offerTokenString?Platform-specific offer token (Android)

WebEntitlement

PropertyTypeDescription
productIdStringThe product identifier
statusStringEntitlement status
expiresAtString?ISO 8601 expiration date
PropertyTypeDescription
urlStringThe deep link URL
paramsMap<String, dynamic>?Parsed URL parameters

SurveyResult

PropertyTypeDescription
surveyIdStringThe survey identifier
answersList<SurveyAnswer>Collected answers

SurveyAnswer

PropertyTypeDescription
questionIdStringThe question identifier
valuedynamicThe answer value