This page will guide you to integrate and verify Contlo SDK in your Flutter application.

Prerequisites

To start the SDK integration, you must first create an API key and install the Mobile Push app from the Contlo App market. Go to your Contlo Dashboard and follow the steps below:

Create an API key

  1. Go to your profile section at the top right corner and click Settings.
  2. Go to Accounts > Store Settings from the sidebar on the Settings homepage.
  3. Go to the API keys tab on the Store Settings page and click Create key on the Private API keys section.
  1. Copy the newly created API key to add it later during the SDK integration.

Install Mobile push

  1. Go to App Market from the sidebar and search Mobile Push.
  2. Click Install.

Installation

To install the Contlo SDK in your Flutter project, follow the steps below:

  1. In your Flutter project, open the pubspec.yaml file and add the contlo_plugin under dependencies:
dependencies:
  contlo_plugin: ^1.0.0
  1. To fetch the Contlo package, save the changes made on pubspec.yaml file and run the follwing command in the terminal:
flutter pub get
  1. To use the Contlo SDK in your Flutter project, import the SDK in the respective dart file.
import 'package:contlo_plugin/contlo_plugin.dart';

📘

Every method within the Contlo SDK is asynchronous, that means you must invoke them using the async and await keyword.

Initialization

Once the installation is complete, follow the steps below to initialize the Contlo SDK:

  1. Open the file that represents the start of the application (eg. main.dart) and import the Contlo package.
import 'package:contlo_plugin/contlo_plugin.dart';
  1. Add the Contlo's init() method after the your App's runApp() method.
    1. Pass the API key (created from the Contlo dashboard) as the parameter in the init() method.
void main() {
runApp (const MyApp ()) ;

ContloPlugin.init("<Your API KEY>");
}

Verify Integration:

After initializing the SDK, open your application on a device or emulator.

Go to the Audiences section on your Contlo dashboard. You would see a new anonymous user is created.

You have successfully integrated the Contlo Flutter SDK.

Welcome aboard!