loadGoogleAd method

void loadGoogleAd({
  1. required GoogleAdType adType,
  2. String action = "default",
  3. required AdCallerInterface callerInterface,
})

Method To Load Different Ad Type in One This Include GoogleAdType

Implementation

void loadGoogleAd(
    {required GoogleAdType adType,
    String action = "default",
    required AdCallerInterface callerInterface}) {
  AdBase adBase =
      NavigationService.navigatorKey.currentContext!.read<AdBase>();
  Map json = adBase.data!;
  switch (adType) {
    case GoogleAdType.fullScreen:
      GoogleFullscreenX().callAds(
        action: action,
        adId: UtilsSingleTone().forceTest
            ? TestIdsConst().googleTestFullScreenID
            : json['adIds']['google']['fullScreen'],
        adCallerInterface: callerInterface,
      );
      break;
    case GoogleAdType.rewardVideo:
      GoogleRewardVideoX().callAds(
        action: action,
        adId: UtilsSingleTone().forceTest
            ? TestIdsConst().googleTestRewardID
            : json['adIds']['google']['rewardVideo'],
        adCallerInterface: callerInterface,
      );
      break;
    case GoogleAdType.rewardNormal:
      GoogleRewardNormalX().callAds(
        action: action,
        adId: UtilsSingleTone().forceTest
            ? TestIdsConst().googleTestRewardID
            : json['adIds']['google']['reward'],
        adCallerInterface: callerInterface,
      );
      break;
    case GoogleAdType.appOpen:
      GoogleAppOpenX().callAds(
        adId: UtilsSingleTone().forceTest
            ? TestIdsConst().googleAppOpen
            : json['adIds']['google']['appOpen'],
        adCallerInterface: callerInterface,
      );
      break;
  }
}