pub package

sourcepoint_cmp

Flutter Plugin for integrating Sourcepoint CMP

Usage

To use this plugin, add sourcepoint_cmp as a dependency in your pubspec.yaml file.

Example

import 'package:flutter/material.dart';
import 'package:sourcepoint_cmp/sourcepoint_cmp.dart';

  @override
  void initState() {
    super.initState();

    _sourcepointCmp = SourcepointCmp(
        accountId: 22,
        propertyId: 7639,
        propertyName: "tcfv2.mobile.webview",
        pmId: "122058",
        onConsentUIReady: () {
          debugPrint('onConsentUIReady');
        },
        onConsentUIFinished: () {
          debugPrint('onConsentUIFinished');
        },
        onAction: (ActionType action) {
          print('onAction(${action.toString()})');
        },
        onConsentReady: ({GDPRUserConsent consent}) {
          print('consentReady');
        },
        onError: (errorCode) {
          print('consentError: errorCode:$errorCode');
        });

    //Show on Start
    _sourcepointCmp.load();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: const Text('Plugin example app'),
          ),
          body: Column(
            children: [
              Center(
                child: FlatButton(
                  color: Colors.blue,
                  textColor: Colors.white,
                  disabledColor: Colors.grey,
                  disabledTextColor: Colors.black,
                  padding: EdgeInsets.all(8.0),
                  splashColor: Colors.blueAccent,
                  onPressed: () {
                    _sourcepointCmp.showPM(); //show Privacy Manager
                  },
                  child: Text(
                    "Show PrivacyManager",
                    style: TextStyle(fontSize: 20.0),
                  ),
                ),
              ),
            ],
          )),
    );
  }