Flutter – Configuring

iOS

Create Adapty-Info.plist and add it to you project. Add the flag AdaptyPublicSdkKey in this file with the value of your Public SDK key.

<dict>
    <key>AdaptyPublicSdkKey</key>
    <string>PUBLIC_SDK_KEY</string>
</dict>

Android

Add the flag AdaptyPublicSdkKey in the app’s AndroidManifest.xml (Android) file with the value of your Public SDK key.

<application ...>
       ...
       <meta-data
              android:name="AdaptyPublicSdkKey"
              android:value="PUBLIC_SDK_KEY" />
</application>

📘

Public SDK key can be found in your app settings in Adapty Dashboard App settings > General.

Then in your application:

import 'package:adapty_flutter/adapty_flutter.dart';

And finally, activate Adapty SDK with the following code:

try {
    await Adapty().activate();
} on AdaptyError catch (adaptyError) {}
} catch (e) {}

🚧

Make sure you use the Public SDK key for Adapty initialization, the Secret key should be used for server-side API only.

📘

SDK keys are unique for every app, so if you have multiple apps make sure you choose the right one.

Logging

Adapty logs errors and other important information to help you understand what is going on. There are three levels available:

  1. error: only errors will be logged
  2. warn: messages from the SDK that do not cause critical errors, but are worth paying attention to
  3. info: various information messages, such as those that log the lifecycle of various modules
  4. verbose: any additional information that may be useful during debugging, such as function calls, API queries, etc.

You can set logLevel in your app before configuring Adapty.

try {
    await Adapty().setLogLevel(AdaptyLogLevel.verbose);
} on AdaptyError catch (adaptyError) {
} catch (e) {}