Next14 CMP for Flutter

Installation

  add {next14cmpFlutter} as a dependency in your pubspec.yaml file.

How to use

Initialization

The Next14 CMP SDK need to retrieves configurations at startup which contains all the data needed to present the consent screen to the user.

The initialization is done via the start method.

    final _next14cmpFlutterPlugin = Next14cmpFlutter();
    await _next14cmpFlutterPlugin
        .start("<YOUR API KEY>", 180)
        .then((value) => ... );

Parameters

Parameter Description Required
apiKey The application unique identifier on the CMP platform Yes
consentPreferenceValidityDays the number of days since the last time the user has given consent, after which the request for consent is presented again to the user No

After the SDK has been initialized, the application should call the shouldPresentCMP method to check if the consent screen need to be displayed to the user, and if so it should call the present method.

The present method takes an optional callback that will be invoked when the user has expressed his consent and the consent UI has been fully dismissed.

   _next14cmpFlutterPlugin
        .shouldPresent()
        .then((value) {
            if (value) {
                _next14cmpFlutterPlugin.present();
            }
        });
Parameter Description Required
gdprApplies whether the GDPR applies to the current user or not No
callback an optional callback to be notified when the consent screen is closed No