setConsent method

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

Implementation

void setConsent({
  bool? adPersonalizationSignalsConsentGranted,
  bool? adStorageConsentGranted,
  bool? adUserDataConsentGranted,
  bool? analyticsStorageConsentGranted,
  bool? functionalityStorageConsentGranted,
  bool? personalizationStorageConsentGranted,
  bool? securityStorageConsentGranted,
}) {
  final consentSettings = {
    if (adPersonalizationSignalsConsentGranted != null)
      'ad_personalization':
          adPersonalizationSignalsConsentGranted ? 'granted' : 'denied',
    if (adStorageConsentGranted != null)
      'ad_storage': adStorageConsentGranted ? 'granted' : 'denied',
    if (adUserDataConsentGranted != null)
      'ad_user_data': adUserDataConsentGranted ? 'granted' : 'denied',
    if (analyticsStorageConsentGranted != null)
      'analytics_storage':
          analyticsStorageConsentGranted ? 'granted' : 'denied',
    if (functionalityStorageConsentGranted != null)
      'functionality_storage':
          functionalityStorageConsentGranted ? 'granted' : 'denied',
    if (personalizationStorageConsentGranted != null)
      'personalization_storage':
          personalizationStorageConsentGranted ? 'granted' : 'denied',
    if (securityStorageConsentGranted != null)
      'security_storage':
          securityStorageConsentGranted ? 'granted' : 'denied',
  }.jsify();

  return analytics_interop.setConsent(
    consentSettings,
  );
}