Skip to content

Initializing the SDK

kris-opti edited this page Jun 7, 2024 · 4 revisions

1. Pub dependency

Add the following dependency to your pubspec.yaml and run pub install:

dependencies:
  optimove_sdk_flutter: 1.0.0

2. Initialization

Depending on which features were enabled for your app you will be able to retreive the following credentials from the Settings section of your Optimove UI:

  • YOUR_OPTIMOVE_CREDENTIALS – Your unique SDK token in order to identify your Optimove tenant
  • YOUR_OPTIMOVE_MOBILE_CREDENTIALS – The mobile config used to identify your app bundle

Create a optimove.json file in your project's root directory with the following:

{
  "optimoveCredentials": "YOUR_OPTIMOVE_CREDENTIALS",
  "optimobileCredentials": "YOUR_OPTIMOVE_MOBILE_CREDENTIALS",
  "inAppConsentStrategy": "in-app-disabled|auto-enroll|explicit-by-user",
  "enableDeferredDeepLinking": false
}

Declare the asset in your pubspec.yaml:

assets:
  - optimove.json

In your Dart code, you can now import & use Optimove features:

import 'package:optimove_sdk_flutter/optimove.dart';