AdsService class

Properties

bannerAdUnitId → String?
no setter
bannerController → BannerAdController
no setter
canRequestAds → bool
no setter
canShowBanner → bool
no setter
config → AdsConfig
no setter
hasAppOpen → bool
no setter
hasBanner → bool
no setter
hasDirectInterstitial → bool
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasInterstitial → bool
no setter
hasNative → bool
no setter
hasRewarded → bool
no setter
isAppOpenBlocked → bool
no setter
isRewardedLoading → bool
no setter
isRewardedReady → bool
no setter
nativeHandler → NativeHandler?
no setter
onAdClicked ↔ VoidCallback?
getter/setter pair
rewardedState → AdState
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
visitsUntilNextAd → int
no setter

Methods

blockAppOpen(String reason, {Duration timeout = _defaultBlockerTimeout}) → void
Block app-open ads until unblockAppOpen is called with the same reason. timeout is a safety net — the blocker auto-clears after it elapses, so a missed unblock can't permanently disable app-open ads.
cancelSkipNextAppOpen() → void
Cancel a pending one-shot skip (rarely needed).
clearAppOpenBlockers() → void
Clear everything (e.g. on logout / route reset).
dispose() → void
dPrintDebug() → void
getDebugState() → Map<String, dynamic>
loadNative({NativeTemplateSize? size, int? maxAttempts}) → Future<bool>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onScreenVisit() → void
Called on every screen visit to passively track frequency. Does NOT trigger a load — only shows if an ad is already cached. Use showBeforeNavigation for navigation-gated ad display instead.
preloadRewarded() → Future<void>
refreshConfig() → Future<void>
refreshConsent() → Future<void>
Re-reads the UMP decision after the user changes privacy settings.
resetCounter() → void
runWithoutAppOpen<T>(Future<T> action(), {String reason = 'scoped_action', Duration timeout = _defaultBlockerTimeout, Duration releaseDelay = const Duration(seconds: 1)}) → Future<T>
Convenience: run any async action with app-open ads suppressed. Guaranteed to unblock even if the action throws.
setProChecker(ProChecker checker) → void
showAppOpen() → Future<bool>
showBeforeNavigation(VoidCallback onComplete) → void
Shows an interstitial before navigation when the threshold is met. Counter is only reset if an ad was actually ready to show. If no ad is cached, the user navigates freely and a background load starts.
showDirect({VoidCallback? onDismissed, VoidCallback? onResumeNavigation}) → void
Splash/direct interstitial: never reload, never retry-on-call.
showInterstitialNow() → Future<bool>
Shows an interstitial immediately, bypassing the screen counter. Returns false if no ad is loaded — does NOT trigger a load.
showRewarded({Future<void> onUserEarnedReward()?, VoidCallback? onDismissed}) → Future<bool>
skipNextAppOpen() → void
Skip the next app-open ad opportunity (one-shot). Use right before launching something that briefly leaves the app: permission dialogs, openAppSettings(), share sheet, intent chooser...
toString() → String
A string representation of this object.
inherited
unblockAppOpen(String reason) → void
Remove a named blocker.

Operators

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

Static Properties

instance → AdsService
Safe instance: never throws, even if initialize() was never called.
no setter
isInitialized → bool
no setter

Static Methods

initialize({required AdsKeyProvider keyProvider, ProChecker? isProUser, AdsConsentChecker? consentChecker, AdsSdkInitializer? sdkInitializer}) → Future<AdsService>
reset() → void