Admob Consent Plugin

Pub Version

An extended wrapper for Google's Mobile Ads Consent SDK, i.e. used as GDPR dialog on Android and iOS. The Android version has been modified to include localized consent forms. Customizable to include own Publisher ID and privacy policy URL.


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


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

final AdmobConsent _admobConsent = AdmobConsent(); "REPLACE_WITH_YOUR_PUBLISHER_ID", privacyURL: "URL_TO_YOUR_PRIVACY_POLICY");

Publisher ID

Your publisher ID is the unique identifier for your AdMob account. Find your publisher ID. It should look like this pub-XXXXXXXXXXXXXXXX.


You can listen to the onConsentFormLoaded, onConsentFormOpened, onConsentFormClosed and onConsentFormError streams.

_admobConsent.onConsentFormClosed.listen((bool status) {
    // Status true if personalized
    // Handle it, ie. set targetingInfo

Enjoy it?

Buy Me A Coffee


You most likely have to fiddle with proguards to keep some classes from being obfuscated or disable minifyEnabled.

# Keep classes of this plugin
-keep class com.anteger.** { *; }

# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-dontwarn sun.misc.**
#-keep class** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class** { <fields>; }

# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * implements
-keep class * implements
-keep class * implements
-keep class * implements

# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * { <fields>;


Example Screenshot