EasyAdsConfig class
Everything the package needs to know, in one immutable object.
Every field is safe to change at runtime through
EasyAds.instance.updateConfig(...), which is how you drive the package
from Firebase Remote Config: fetch, build a new config, push it in. Ads
already cached stay cached; the new values apply to the next decision.
Constructors
-
EasyAdsConfig({required EasyAdUnitIds adUnitIds, bool enabled = true, bool appOpenColdStartEnabled = true, bool appOpenResumeEnabled = true, bool interstitialEnabled = true, bool rewardedEnabled = true, bool rewardedInterstitialEnabled = true, bool bannerEnabled = true, Duration loadTimeout = const Duration(seconds: 15), Duration sdkInitTimeout = const Duration(seconds: 5), Duration fullScreenTtl = const Duration(minutes: 50), Duration appOpenTtl = const Duration(hours: 3, minutes: 30), int maxLoadRetries = 3, Duration retryBaseDelay = const Duration(seconds: 2), Duration maxRetryDelay = const Duration(seconds: 32), Duration appOpenCooldown = Duration.zero, Duration interstitialCooldown = const Duration(seconds: 180), Duration minGapAfterFullScreenAd = const Duration(seconds: 120), Duration appOpenColdStartMaxWait = const Duration(seconds: 5), int appOpenMinSessions = 1, int? appOpenDailyCap = 3, int? appOpenWindowCap = 2, Duration appOpenWindow = const Duration(hours: 1), int? interstitialDailyCap = 6, int? interstitialWindowCap = 2, Duration interstitialWindow = const Duration(hours: 1), bool collapsibleBannerOncePerSession = true, List<
String> testDeviceIds = const [], bool allowTestDevicesInRelease = false, bool forceConsentDebugGeographyEea = false, String? maxAdContentRating, int? tagForChildDirectedTreatment, int? tagForUnderAgeOfConsent, List<String> ? requestKeywords, bool verboseLogging = false, void onEvent(EasyAdEvent event)?, void onPaidEvent(EasyAdRevenue revenue)?, void onError(Object error, StackTrace stackTrace)?}) -
Creates a configuration. The defaults are the conservative,
policy-safe ones described on each field.
const
Properties
- adUnitIds → EasyAdUnitIds
-
Ad unit IDs per platform.
final
- allowTestDevicesInRelease → bool
-
Applies testDeviceIds even in release builds. Only for a staged
release-mode QA pass.
final
- appOpenColdStartEnabled → bool
-
Allows the cold start (splash) App Open ad.
final
- appOpenColdStartMaxWait → Duration
-
How long AppOpenAdManager.showOnColdStart may wait for its ad.
final
- appOpenCooldown → Duration
-
Minimum time between two App Open ads.
final
- appOpenDailyCap → int?
-
Per-day cap for App Open ads, or null for no cap.
final
- appOpenMinSessions → int
-
Number of app sessions before the first App Open ad is allowed.
final
- appOpenResumeEnabled → bool
-
Allows the App Open ad when the app returns from the background.
final
- appOpenTtl → Duration
-
How long a cached App Open ad stays usable.
final
- appOpenWindow → Duration
-
The span appOpenWindowCap counts impressions over. Defaults to an hour.
final
- appOpenWindowCap → int?
-
How many App Open ads may be shown per appOpenWindow, or null for no
cap.
final
-
Kill switch for banners.
final
- collapsibleBannerOncePerSession → bool
-
Requests a collapsible banner at most once per app session.
final
- enabled → bool
-
Master switch. Set to
falsefor paying users — every show and preload turns into a no-op, and no requests are sent.final - forceConsentDebugGeographyEea → bool
-
Makes the UMP SDK treat the device as if it were in the EEA so the
consent form can be tested. Debug builds only; requires the device to be
listed in testDeviceIds.
final
- fullScreenTtl → Duration
-
How long a cached interstitial/rewarded ad stays usable.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- interstitialCooldown → Duration
-
Minimum time between two interstitials.
final
- interstitialDailyCap → int?
-
Per-day cap for interstitials, or null for no cap.
final
- interstitialEnabled → bool
-
Kill switch for interstitials.
final
- interstitialWindow → Duration
-
The span interstitialWindowCap counts impressions over. Defaults to an
hour.
final
- interstitialWindowCap → int?
-
How many interstitials may be shown per interstitialWindow, or null for
no cap.
final
- loadTimeout → Duration
-
How long a single load attempt may take before it is abandoned. The SDK
itself has no timeout: without this a request on a dead network can stay
pending indefinitely and block the retry loop.
final
- maxAdContentRating → String?
-
Maximum content rating for served ads. Use the MaxAdContentRating
constants (
MaxAdContentRating.g,.pg,.t,.ma).final - maxLoadRetries → int
-
How many extra attempts the background preloader makes after a no-fill.
final
- maxRetryDelay → Duration
-
Ceiling for the exponential retry backoff.
final
- minGapAfterFullScreenAd → Duration
-
How long after any other full screen ad closes the App Open ad stays
suppressed.
final
- onError → void Function(Object error, StackTrace stackTrace)?
-
Called for every swallowed exception — forward to Crashlytics/Sentry.
The package never rethrows: a broken ad must not crash the host app.
final
- onEvent → void Function(EasyAdEvent event)?
-
Called for every lifecycle event — forward to analytics.
final
- onPaidEvent → void Function(EasyAdRevenue revenue)?
-
Called for every impression-level revenue event.
final
-
requestKeywords
→ List<
String> ? -
Keywords attached to every ad request, for contextual targeting.
final
- retryBaseDelay → Duration
-
First retry delay; doubles per attempt up to maxRetryDelay.
final
- rewardedEnabled → bool
-
Kill switch for rewarded ads.
final
- rewardedInterstitialEnabled → bool
-
Kill switch for rewarded interstitials.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sdkInitTimeout → Duration
-
How long to wait for
MobileAds.initialize()before loading anyway.final - tagForChildDirectedTreatment → int?
-
COPPA tag — set it if your app is child-directed. Use the
TagForChildDirectedTreatment constants.
final
- tagForUnderAgeOfConsent → int?
-
GDPR under-age-of-consent tag. Use the TagForUnderAgeOfConsent
constants.
final
-
testDeviceIds
→ List<
String> -
Device IDs that should always receive test ads. Find yours in the device
log after the first ad request.
final
- verboseLogging → bool
-
Prints every lifecycle event with
debugPrint. Debug builds only.final
Methods
-
copyWith(
{EasyAdUnitIds? adUnitIds, bool? enabled, bool? appOpenColdStartEnabled, bool? appOpenResumeEnabled, bool? interstitialEnabled, bool? rewardedEnabled, bool? rewardedInterstitialEnabled, bool? bannerEnabled, Duration? loadTimeout, Duration? sdkInitTimeout, Duration? fullScreenTtl, Duration? appOpenTtl, int? maxLoadRetries, Duration? retryBaseDelay, Duration? maxRetryDelay, Duration? appOpenCooldown, Duration? interstitialCooldown, Duration? minGapAfterFullScreenAd, Duration? appOpenColdStartMaxWait, int? appOpenMinSessions, int? appOpenDailyCap, bool clearAppOpenDailyCap = false, int? appOpenWindowCap, bool clearAppOpenWindowCap = false, Duration? appOpenWindow, int? interstitialDailyCap, bool clearInterstitialDailyCap = false, int? interstitialWindowCap, bool clearInterstitialWindowCap = false, Duration? interstitialWindow, bool? collapsibleBannerOncePerSession, List< String> ? testDeviceIds, bool? allowTestDevicesInRelease, bool? forceConsentDebugGeographyEea, String? maxAdContentRating, int? tagForChildDirectedTreatment, int? tagForUnderAgeOfConsent, List<String> ? requestKeywords, bool? verboseLogging, void onEvent(EasyAdEvent event)?, void onPaidEvent(EasyAdRevenue revenue)?, void onError(Object error, StackTrace stackTrace)?}) → EasyAdsConfig - Returns a copy with the given fields replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited