toConfig method

AdsConfig toConfig({
  1. bool? bannerEnabled,
  2. bool? interstitialEnabled,
  3. bool? nativeEnabled,
  4. bool? appOpenEnabled,
  5. bool? rewardedEnabled,
  6. bool? directInterstitialEnabled,
  7. bool adsEnabled = true,
  8. int interstitialAfter = 3,
  9. int maxRetryAttempts = 2,
  10. Duration retryBaseDelay = const Duration(seconds: 10),
  11. bool preloadEnabled = true,
  12. Duration connectivityRecheckInterval = const Duration(minutes: 3),
})

Implementation

AdsConfig toConfig({
  bool? bannerEnabled,
  bool? interstitialEnabled,
  bool? nativeEnabled,
  bool? appOpenEnabled,
  bool? rewardedEnabled,
  bool? directInterstitialEnabled,
  bool adsEnabled = true,
  int interstitialAfter = 3,
  int maxRetryAttempts = 2,
  Duration retryBaseDelay = const Duration(seconds: 10),
  bool preloadEnabled = true,
  Duration connectivityRecheckInterval = const Duration(minutes: 3),
}) {
  return AdsConfig(
    bannerIds: banner,
    interstitialIds: interstitial,
    rewardedIds: rewarded,
    nativeIds: native,
    appOpenIds: appOpen,
    directInterstitialIds: directInterstitial,
    bannerEnabled: bannerEnabled ?? banner?.isAvailable == true,
    interstitialEnabled:
        interstitialEnabled ?? interstitial?.isAvailable == true,
    // Native ads are opt-in because they normally need a custom layout.
    nativeEnabled: nativeEnabled ?? false,
    appOpenEnabled: appOpenEnabled ?? appOpen?.isAvailable == true,
    rewardedEnabled: rewardedEnabled ?? rewarded?.isAvailable == true,
    directInterstitialEnabled:
        directInterstitialEnabled ?? directInterstitial?.isAvailable == true,
    adsEnabled: adsEnabled,
    interstitialAfter: interstitialAfter,
    maxRetryAttempts: maxRetryAttempts,
    retryBaseDelay: retryBaseDelay,
    preloadEnabled: preloadEnabled,
    connectivityRecheckInterval: connectivityRecheckInterval,
  );
}