Flutter

This is a step-by-step guide to including Conscent.ai Plugin in your app. This plugin is developed in Flutter and supports both Android and IOS Devices.

Installation

Use this package as a library

Depend on it

Run this command with Flutter:

flutter pub add flutter_conscent_plugin

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  flutter_conscent_plugin: ^0.4.2

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:flutter_conscent_plugin/flutter_conscent_plugin.dart';
Initialize SDK

In your application pass these fields in your app.

  • client_id - Pass your clientId received from Conscent.ai.

  • ENVIRONMENTMODE - configuration testing of different environments available.

ENVIRONMENTMODE can be set as :
    ENVIRONMENTMODE.SANDBOX 
    ENVIRONMENTMODE.PRODUCTION

The below code can be used as a sample:

ConscentInitializer("your_client_id", ENVIRONMENTMODE.SANDBOX);

Initialize Paywall

  1. Pass client content id in setContentId(clientContentId) Method:

Attaching the code below for the refernce:

  1. Check content access and show the paywall:

These methods need to be called on the Content Page.

Handling Events

  1. Scroll Listener Event

  1. Exit from the Content page

The below method is called to Logout from Conscent.ai

Last updated