toConfig method
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),
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,
);
}