load method

void load({
  1. required String appKey,
  2. bool tagForUnderAgeOfConsent = false,
  3. dynamic onConsentFormLoadSuccess(
    1. ConsentStatus
    )?,
  4. dynamic onConsentFormLoadFailure(
    1. ConsentError
    )?,
})

Load consent form to determine the user's consent preferences.

Parameters:

  • appKey: The Appodeal application key.
  • tagForUnderAgeOfConsent: Flag to tag the user as under the age of consent.
  • onConsentFormLoadSuccess: Callback for successful consent form loading.
  • onConsentFormLoadFailure: Callback for failed consent form loading.

Implementation

void load({
  required String appKey,
  bool tagForUnderAgeOfConsent = false,
  Function(ConsentStatus)? onConsentFormLoadSuccess,
  Function(ConsentError)? onConsentFormLoadFailure,
}) {
  _consentManagerChannel.setMethodCallHandler((call) async {
    switch (call.method) {
      case 'onConsentFormLoadSuccess':
        onConsentFormLoadSuccess
            ?.call(_ConsentStatusExt._fromInt(call.arguments['status']));
        break;
      case 'onConsentFormLoadFailure':
        onConsentFormLoadFailure
            ?.call(ConsentError._(call.arguments['error']));
        break;
    }
  });
  _consentManagerChannel.invokeMethod('load', {
    'appKey': appKey,
    'tagForUnderAgeOfConsent': tagForUnderAgeOfConsent,
  });
}