Flutter Guide

Install

The Flutter SDK can be installed via:

flutter pub add resubscribe_flutter_sdk

Setup

Import Resubscribe.

import 'package:resubscribe_flutter_sdk/resubscribe_flutter_sdk.dart';

Call this, replacing the placeholder values with your own values.

ResubscribeSDK.openWithConsent(
  context,
  aiType: '{{aiType}}', // Replace with the AI type
  userId: '{{userid}}', // Replace with the user ID
  slug: '{{slug}}', // Replace with your slug
  apiKey: '{{apiKey}}', // Replace with your API key
  // debugMode: true,
  // onClose: () {
  //   debugPrint('onClose');
  // },
);

The value of userid MUST be unique. If you do not have a unique user id at the point you want to make this call, we recommend generating a random value prefixed with 'anonymous-' for every user

Configuration

Param nameDescription

aiType

This value affects how the AI interacts with the user. Options are 'intent' and 'churn'. They are described in the Overview page.

apiKey

The secret for authenticating with Resubscribe.

userId

A unique identifier for the user.

slug

The short string identifying your organization.

onClose

A callback that is called whenever the experience is closed.

Customization

The text on the consent popup is already customized to the AI type you choose.

However, if you want to override these values, then you can pass in the consentOptions to the ResubscribeSDK.

ResubscribeSDK.openWithConsent(
  // ...
  consentOptions: const ResubscribeConsentOptions(
    acceptText: 'Let\'s chat!',
    declineText: 'Not right now',
    titleText: 'CUSTOM TITLE',
    descriptionText: 'CUSTOM CONTENT',
  ),
  // ...
)

Last updated