EasyAds class
The package entry point.
await EasyAds.instance.initialize(
config: EasyAdsConfig(adUnitIds: const EasyAdUnitIds.test()),
store: PrefsStore(),
);
EasyAds.instance.appOpen.startWatchingAppState();
EasyAds.instance.preloadAll();
Initialization order is deliberate and matters: consent is gathered first, then targeting settings are applied, then the SDK is initialized, and only then may ads be requested. Requesting before consent costs EEA fill; requesting before initialization finishes means mediation adapters miss the first request.
Properties
- appOpen → AppOpenAdManager
-
App Open ads.
no setter
-
appState
→ Stream<
AppState> -
Foreground/background events, for app logic that needs them too.
no setter
- config → EasyAdsConfig
-
The live configuration.
no setter
- consent → ConsentManager
-
UMP consent: privacy options entry point, reset for testing, and the
canRequestAdsstate.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- interstitial → InterstitialAdManager
-
Interstitial ads.
no setter
- isConfigured → bool
-
True once initialize has been called (the SDK itself may still be
starting up).
no setter
- isReady → bool
-
True once the Google Mobile Ads SDK finished initializing.
no setter
- rewarded → RewardedAdManager
-
Rewarded ads.
no setter
- rewardedInterstitial → RewardedInterstitialAdManager
-
Rewarded interstitial ads.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
consumeCollapsibleSlot(
) → bool - Takes this session's single collapsible banner slot.
-
dispose(
) → void - Releases every cached ad and stops the app state listener.
-
ensureInitialized(
) → Future< bool> - Awaits consent gathering and SDK initialization, starting them if they have not run yet. Returns false when initialization failed.
-
initialize(
{required EasyAdsConfig config, EasyAdsStore? store, DateTime clock()?}) → Future< bool> - Configures the package and starts the SDK.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
openAdInspector(
) → Future< void> - Opens Google's Ad Inspector overlay.
-
preloadAll(
) → void - Warms the cache for every full screen format.
-
setAdsEnabled(
bool enabled) → Future< void> -
Turns all ads on or off — call with
falseas soon as you know the user is a subscriber. No requests are sent while disabled. -
setAppMuted(
bool muted) → Future< void> - Mutes or unmutes video ad audio.
-
setAppVolume(
double volume) → Future< void> - Sets the relative volume of video ads, from 0 (silent) to 1 (full).
-
toString(
) → String -
A string representation of this object.
inherited
-
updateConfig(
EasyAdsConfig config) → Future< void> - Replaces the configuration at runtime — the hook for Firebase Remote Config. Cached ads are kept; the new values apply to the next decision.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited