initializeUMP method

Future<FormError?> initializeUMP(
  1. List<String>? testDeviceIds
)

Initializes Admob and handles consent forms if applicable. Returns a Future<FormError?> indicating the result of the initialization.

Implementation

Future<FormError?> initializeUMP(List<String>? testDeviceIds) async {
  final completer = Completer<FormError?>();
  final params = ConsentRequestParameters(
      consentDebugSettings: ConsentDebugSettings(
    debugGeography: DebugGeography.debugGeographyEea,
  ));

  ConsentInformation.instance.requestConsentInfoUpdate(
    params,
    () async {
      if (await ConsentInformation.instance.isConsentFormAvailable()) {
        // Load Consent form if available.
        await _loadConsentForm(testDeviceIds);
      } else {
        // Continue with regular initialization.
        await _initialize(testDeviceIds);
      }
      completer.complete();
    },
    (error) {
      // Handle error during consent info update.
      completer.complete(error);
    },
  );
  return completer.future;
}