ConsentManager class
Manages the UMP (User Messaging Platform) consent flow.
Handles GDPR/CCPA consent automatically during initialization, and provides manual access for settings screens.
// Automatic (during initialization)
await adManager.initialize(); // consent flow runs automatically
// Manual (from a settings screen)
final result = await adManager.consent.requestConsent();
// Check status
if (adManager.consent.canShowPersonalizedAds) {
print('Personalized ads allowed');
}
Constructors
- ConsentManager({required AdManager adManager})
-
Creates a consent manager bound to the given
adManager.
Properties
- canShowPersonalizedAds → bool
-
Whether personalized ads can be shown based on current consent.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
isConsentFormAvailable
→ Future<
bool> -
Whether a consent form is available for display.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → ConsentStatus
-
The current consent status.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
requestConsent(
) → Future< ConsentResult> - Requests consent information and shows the consent form if needed.
-
reset(
) → void - Resets consent information (debug/testing only).
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited