cmp_sdk 0.1.0 copy "cmp_sdk: ^0.1.0" to clipboard
cmp_sdk: ^0.1.0 copied to clipboard

The consentmanager (CMP) Flutter Plugin allows you to easily integrate Consent Management functionality into your Flutter applications for handling user consent and privacy preferences.

cmp_sdk #

A Flutter plugin for integrating and managing consent management platform (CMP) functionalities within your Flutter application. The cmp_sdk provides a simple and efficient way to handle user consents for data collection and usage in compliance with privacy laws like GDPR.

Features #

  • Initialize CMP with custom configurations.
  • Open consent layer UI with configurable presentation styles.
  • Check and manage user consents for vendors and purposes.
  • Import/export CMP configuration strings.
  • Full support for custom callbacks and consent status checks.

Installation #

To use the cmp_sdk plugin, add it to your pubspec.yaml file:

dependencies:
  cmp_sdk: ^x.x.x

Then, run the following command to install the plugin:

flutter pub get

Quick Start #

To create an instance of CmpSdk with a basic configuration:

import 'package:cmp_sdk/cmp_sdk.dart';
import 'package:cmp_sdk/cmp_config.dart';

void main() {
  runApp(MyApp());

  // Initialize CMP SDK with basic configuration
  final cmpSdk = CmpSdk.createInstance(
    id: "your_cmp_id",
    domain: "your_cmp_domain",
    appName: "your_app_name",
    language: "your_preferred_language",
  );
}

Example Usage #

Below is an example of how you can use the cmp_sdk within your application to configure the consent layer and handle user consents:

import 'package:flutter/material.dart';
import 'package:cmp_sdk/cmp_sdk.dart';
import 'package:cmp_sdk/cmp_config.dart';
import 'package:cmp_sdk/cmp_ui_config.dart';

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late CmpSdk cmpSdk;

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

  Future<void> initCmpSdk() async {
    // Create CMP SDK instance with custom configuration
    final cmpConfig = CmpConfig(
      id: "your_cmp_id",
      domain: "your_cmp_domain",
      appName: "your_app_name",
      language: "your_preferred_language",
      isDebugMode: true,
    );
    cmpSdk = CmpSdk.createInstanceWithConfig(cmpConfig);

    // Configure consent layer UI
    await cmpSdk.configureConsentLayer(CmpUiConfig(
      modalPresentationStyle: ModalPresentationStyle.fullScreen,
    ));

    // Initialize CMP SDK and perform necessary setup
    await cmpSdk.initialize();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('CMP SDK Example'),
        ),
        body: Center(
          child: ElevatedButton(
            onPressed: () async {
              // Open the consent layer for the user to give consent
              await cmpSdk.open();
            },
            child: Text('Open Consent Layer'),
          ),
        ),
      ),
    );
  }
}

This example demonstrates how to initialize the CmpSdk with a custom configuration, configure the consent layer's UI, and then open the consent layer for user interaction.

For more detailed documentation and advanced usage, please refer to the official documentation.

Documentation #

For more detailed information on how to integrate and use cmp_sdk in your Flutter projects, including advanced configurations, consent layer customization, and handling user consents, please refer to our official documentation:

Flutter Integration Guide

This guide provides step-by-step instructions, best practices, and additional resources to help you effectively implement and manage the CMP functionalities within your app.

Support #

For support and further questions, please contact the plugin maintainers or open an issue on the plugin's GitHub repository.

1
likes
150
pub points
79%
popularity

Publisher

verified publisherbentech.app

The consentmanager (CMP) Flutter Plugin allows you to easily integrate Consent Management functionality into your Flutter applications for handling user consent and privacy preferences.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on cmp_sdk