1. Configure the SDK
Initialize AppDNA as early as possible in your app lifecycle, typically in yourmain() function before runApp():
If you don’t have your own Firebase: Keep
Firebase.initializeApp() as shown above.If you already use Firebase in your Flutter app: Remove the Firebase.initializeApp() call and just call AppDNA.configure(...). The SDK automatically initializes its own named Firebase instance from GoogleService-Info-AppDNA.plist (iOS) and google-services-appdna.json (Android). Your existing Firebase setup is not affected.Configuration Options
TheAppDNAOptions class lets you customize SDK behavior:
| Parameter | Type | Default | Description |
|---|---|---|---|
flushInterval | int? | 30 | Seconds between automatic event flushes |
batchSize | int? | 20 | Number of events to batch before flushing |
configTTL | int? | 300 | Seconds before cached config is considered stale |
logLevel | AppDNALogLevel? | AppDNALogLevel.warning | Verbosity of SDK console logs |
billingProvider | AppDNABillingProvider? | AppDNABillingProvider.storeKit2 | Billing integration to use |
Environment
TheAppDNAEnvironment enum controls which backend environment the SDK targets:
| Value | Description |
|---|---|
AppDNAEnvironment.production | Production API and configuration |
AppDNAEnvironment.staging | Staging API for testing |
Log Level
TheAppDNALogLevel enum controls console log verbosity:
| Value | Description |
|---|---|
AppDNALogLevel.none | No logging |
AppDNALogLevel.error | Errors only |
AppDNALogLevel.warning | Errors and warnings |
AppDNALogLevel.info | Errors, warnings, and info |
AppDNALogLevel.debug | All messages including debug |
Use
AppDNALogLevel.debug during development to see all SDK activity. Switch to AppDNALogLevel.warning or AppDNALogLevel.none for production builds.Billing Provider
TheAppDNABillingProvider enum specifies which billing system to use:
| Value | Description |
|---|---|
AppDNABillingProvider.storeKit2 | Native StoreKit 2 (default, iOS only) |
AppDNABillingProvider.revenueCat | RevenueCat integration |
AppDNABillingProvider.none | Disable billing module |
2. Wait for Ready State
The SDK fetches remote configuration asynchronously. UseonReady to know when the SDK is fully initialized:
onReady() returns a Future<void> that completes once the remote configuration has been fetched and applied.
3. Identify Users
Once a user signs in, callidentify to associate events with their user ID:
Traits are merged with any previously set traits. You do not need to pass all traits on every call — only the ones that have changed.
4. Track Events
Track user actions withtrack:
flushInterval and batchSize settings.
5. Flush Events Manually
Force an immediate flush of all queued events:6. Set User Consent
Control whether the SDK collects and sends analytics data:7. Change Log Level at Runtime
Adjust the log level without reconfiguring the SDK:8. Remote Config and Feature Flags
Retrieve server-side configuration values:9. Experiments
Get the variant assigned to a user for an experiment:10. Web Entitlement
Retrieve the current web entitlement:11. Deferred Deep Links
Check for a deferred deep link that brought the user to your app:12. Reset on Logout
When a user signs out, callreset to clear the user identity and flush any remaining events:
13. Shutdown
When the app is terminating, shut down the SDK to ensure all events are flushed and resources are released:You now have the SDK configured with user identification, event tracking, remote config, and experiments working. Continue to the module-specific guides for Push Notifications, Billing, Onboarding, and Paywalls.

