Compliant with GDPR, CCPA, COPPA, LGPD, PECR, PDPA, PIPEDA, and more.
UniConsent CMP is a package for handling GDPR IAB TCF 2.2 consent management in Flutter apps. You can find a demo app integrated with UniConsent CMP in the "uniconsent_demo" directory.
To include the UniConsent package in your Flutter project, add it as a dependency in your pubspec.yaml file:
dependencies:
  uniconsent:
    path: ../uniconsent
Then, sync the dependency by running the following command:
flutter pub get
To use the UniConsent CMP in your app, follow these steps:
Initialize the CMP with an App ID from your account manager:
// Init CMP with appId
UniConsent.instance.setAppId("YOUR_APP_ID_CHANGE_THIS");
Display the CMP UI:
// Display CMP UI
UniConsent.instance.launchCMP(context);
Automatically check if consent is expired when the vendorList updates:
// Automatic check if consent is expired when vendorList updates
UniConsent.instance.shouldRequestConsent().then((shouldUpdate) => {
  if (shouldUpdate)
    {
      // display CMP again
    }
});
Get the tcString if required:
// Get tcString if requried
UniConsent.instance.getConsentInfo().then((info) => print(info?.tcString));
Read the consent status:
// Read consent status
UniConsent.instance
    .getConsentInfo()
    .then((info) => if(info?.purposeConsents.contains(DataUsagePurpose.useLimitedDataToSelectAds)) {
        // do something
    });
Reset consent status if required:
// Reset consent status if required:
UniConsent.instance.clearAll();