AdsServiceImpl class

Unified, production-grade implementation of AdsService.

Fully aligned with Google AdMob & Google Play Policies:

  • 4-hour max-age cache invalidation
  • Centralized full-screen ad collision prevention (AdsManager.instance.isShowingFullScreenAd)
  • Exponential backoff retry logic with automatic cancellation on disposal
  • Minimum interval throttling between interstitials (default 30s)
  • Automatic event tracking via AdsManager.onAdEvent
  • Automatic disposal and preloading on dismissal
Implemented types

Constructors

AdsServiceImpl({AppOpenAdManager? appOpenAdManager, int maxRetryAttempts = 3, Duration maxAdAge = const Duration(hours: 4), Duration minInterstitialInterval = const Duration(seconds: 30)})

Properties

appOpenAdManager → AppOpenAdManager
final
hashCode → int
The hash code for this object.
no setterinherited
isAppOpenAdAvailable → bool
no setteroverride
isInterstitialAdAvailable → bool
no setteroverride
isRewardedAdAvailable → bool
no setteroverride
isRewardedInterstitialAdAvailable → bool
no setteroverride
maxAdAge → Duration
final
maxRetryAttempts → int
final
minInterstitialInterval → Duration
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
override
loadAllAds() → void
override
loadAppOpenAd({String? adUnitId, AdRequest? request, VoidCallback? onLoaded, dynamic onFailedToLoad(LoadAdError error)?}) → void
override
loadInterstitialAd({String? adUnitId, AdRequest? request, VoidCallback? onLoaded, dynamic onFailedToLoad(LoadAdError error)?}) → void
override
loadRewardedAd({String? adUnitId, AdRequest? request, VoidCallback? onLoaded, dynamic onFailedToLoad(LoadAdError error)?}) → void
override
loadRewardedInterstitialAd({String? adUnitId, AdRequest? request, VoidCallback? onLoaded, dynamic onFailedToLoad(LoadAdError error)?}) → void
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
showAppOpenAdIfAvailable({VoidCallback? onAdShowedFullScreenContent, VoidCallback? onAdDismissedFullScreenContent, dynamic onAdFailedToShowFullScreenContent(AdError error)?, OnPaidEventCallback? onPaidEvent}) → void
override
showInterstitialAd({VoidCallback? onAdShowedFullScreenContent, VoidCallback? onAdDismissedFullScreenContent, dynamic onAdFailedToShowFullScreenContent(AdError error)?, VoidCallback? onAdClicked, VoidCallback? onAdImpression, OnPaidEventCallback? onPaidEvent}) → void
override
showRewardedAd({required OnUserEarnedRewardCallback onUserEarnedReward, ServerSideVerificationOptions? serverSideVerificationOptions, VoidCallback? onAdShowedFullScreenContent, VoidCallback? onAdDismissedFullScreenContent, dynamic onAdFailedToShowFullScreenContent(AdError error)?, VoidCallback? onAdClicked, VoidCallback? onAdImpression, OnPaidEventCallback? onPaidEvent}) → void
override
showRewardedInterstitialAd({required OnUserEarnedRewardCallback onUserEarnedReward, ServerSideVerificationOptions? serverSideVerificationOptions, VoidCallback? onAdShowedFullScreenContent, VoidCallback? onAdDismissedFullScreenContent, dynamic onAdFailedToShowFullScreenContent(AdError error)?, VoidCallback? onAdClicked, VoidCallback? onAdImpression, OnPaidEventCallback? onPaidEvent}) → void
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

instance → AdsServiceImpl
final