setConsent method

Future<void> setConsent({
  1. bool? adStorageConsentGranted,
  2. bool? analyticsStorageConsentGranted,
  3. bool? adPersonalizationSignalsConsentGranted,
  4. bool? adUserDataConsentGranted,
  5. bool? functionalityStorageConsentGranted,
  6. bool? personalizationStorageConsentGranted,
  7. bool? securityStorageConsentGranted,
})

Sets the applicable end user consent state. By default, no consent mode values are set.

  • adStorageConsentGranted - Enables storage, such as cookies, related to advertising. (Platform: Android, iOS, Web)
  • analyticsStorageConsentGranted - Enables storage, such as cookies, related to analytics (for example, visit duration). (Platform: Android, iOS, Web)
  • adPersonalizationSignalsConsentGranted - Sets consent for personalized advertising. (Platform: Android, iOS, Web)
  • adUserDataConsentGranted - Sets consent for sending user data to Google for advertising purposes. (Platform: Android, iOS, Web)
  • functionalityStorageConsentGranted - Enables storage that supports the functionality of the website or app such as language settings. (Platform: Web)
  • personalizationStorageConsentGranted - Enables storage related to personalization such as video recommendations. (Platform: Web)
  • securityStorageConsentGranted - Enables storage related to security such as authentication functionality, fraud prevention, and other user protection. (Platform: Web)

Default consents can be set according to the platform:

Implementation

Future<void> setConsent({
  bool? adStorageConsentGranted,
  bool? analyticsStorageConsentGranted,
  bool? adPersonalizationSignalsConsentGranted,
  bool? adUserDataConsentGranted,
  bool? functionalityStorageConsentGranted,
  bool? personalizationStorageConsentGranted,
  bool? securityStorageConsentGranted,
}) async {
  await _delegate.setConsent(
    adStorageConsentGranted: adStorageConsentGranted,
    analyticsStorageConsentGranted: analyticsStorageConsentGranted,
    adPersonalizationSignalsConsentGranted:
        adPersonalizationSignalsConsentGranted,
    adUserDataConsentGranted: adUserDataConsentGranted,
    functionalityStorageConsentGranted: functionalityStorageConsentGranted,
    personalizationStorageConsentGranted:
        personalizationStorageConsentGranted,
    securityStorageConsentGranted: securityStorageConsentGranted,
  );
}