requestConsentInformation static method

Future<ConsentInformation> requestConsentInformation({
  1. bool tagForUnderAgeOfConsent = false,
  2. List<String> testDevicesHashedIds = const <String>[],
  3. DebugGeography debugGeography = DebugGeography.debugGeographyDisabled,
  4. bool? isAndroid,
})

Allows to get the current consent information.

tagForUnderAgeOfConsent Whether to tag for under age of consent. testDevicesHashedIds Provide test devices id in order to force geography to the EEA. debugGeography Force geography to be in EEA or not EEA. Default value is DebugGeography.DEBUG_GEOGRAPHY_DISABLED.

Implementation

static Future<ConsentInformation> requestConsentInformation({
  bool tagForUnderAgeOfConsent = false,
  List<String> testDevicesHashedIds = const <String>[],
  DebugGeography debugGeography = DebugGeography.debugGeographyDisabled,
  bool? isAndroid,
}) async {
  Map<String, dynamic> result = Map<String, dynamic>.from(
    (await _channel.invokeMethod(
          'requestConsentInformation',
          {
            'tagForUnderAgeOfConsent': tagForUnderAgeOfConsent,
            'testDevicesHashedIds': testDevicesHashedIds,
            'debugGeography': debugGeography.value,
          },
        )) ?? // If null default to unknown.
        {
          'consentStatus': ConsentStatus.unknown,
          'isConsentFormAvailable': false,
        },
  );
  return ConsentInformation(
    consentStatus: ConsentStatus.fromValue(result['consentStatus'], isAndroid ?? Platform.isAndroid),
    isConsentFormAvailable: result['isConsentFormAvailable'],
  );
}