FastBaseAd<T> class
abstract
Base abstract class for all ad types
Provides common functionality for ad loading, status tracking, retry logic, and expiration management
- Inheritance
-
- Object
- ChangeNotifier
- FastBaseAd
- Implemented types
- Implementers
- Available extensions
Constructors
- FastBaseAd({required FastAdUnit adUnit, Duration expireDuration = const Duration(minutes: 30)})
- Constructor
Properties
- ad ↔ T?
-
Whether the ad is currently being shown
The actual ad instance from the ad network SDK
getter/setter pair
- adUnit → FastAdUnit
-
广告单元配置
final
- adUnitId → String
-
广告单元ID(便捷属性)
no setter
- autoReloadMinInterval ↔ Duration
-
自动刷新最小间隔,避免极端情况下 close/fail 频繁触发导致刷爆请求
getter/setter pair
- autoReloadOnClose ↔ bool
-
关闭后是否自动刷新(重新发起 load)
getter/setter pair
- expireDuration → Duration
-
Time period after which a loaded ad is considered expired
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isCacheExpired → bool
-
Check if the ad cache has expired
no setter
- isExpired → bool
-
Check if the ad has expired based on load time
no setter
- isLoaded ↔ bool
-
Whether the ad is loaded and ready to display
getter/setter pair
- lastShownPlacementName ↔ String?
-
记录该广告实例“最后一次是被哪个物理广告位展示的”
getter/setter pair
- retryDelay ↔ Duration
-
Delay before the next retry attempt
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value ↔ FastAdStatus
-
The current value of the object.
getter/setter pairoverride-getter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
canShowFrequency(
FastPlacement placement, {required String storagePrefix, bool checkMaxHighPriority = true}) → bool -
Available on FastBaseAd, provided by the AdFrequency extension
检查是否满足显示条件(冷却时间和每日上限) -
clear(
) → void - 清理广告状态和资源
-
dispose(
) → void -
Discards any resources used by the object.
inherited
-
getRemainingCooldownSeconds(
FastPlacement placement, {required String storagePrefix}) → int -
Available on FastBaseAd, provided by the AdFrequency extension
获取距离下次可显示还剩余的时间(秒) -
getTodayShowCount(
FastPlacement placement, {required String storagePrefix}) → int -
Available on FastBaseAd, provided by the AdFrequency extension
获取今日已显示次数 -
load(
) → void - Load the ad from the ad network
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
recordShowFrequency(
FastPlacement placement, {required String storagePrefix}) → Future< void> -
Available on FastBaseAd, provided by the AdFrequency extension
记录广告显示 -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
resetFrequency(
FastPlacement placement, {required String storagePrefix}) → Future< void> -
Available on FastBaseAd, provided by the AdFrequency extension
重置指定广告位的显示记录 -
resetRetry(
) → dynamic -
Available on FastBaseAd, provided by the Retry extension
Reset the retry counter and delay -
retry(
) → dynamic -
Available on FastBaseAd, provided by the Retry extension
Implement exponential backoff retry logic -
setStatus(
FastAdStatus newValue, {bool force = false}) → void - Update ad status and trigger appropriate actions
-
show(
{required FastPlacement placement}) → Future - Display the ad to the user
-
showDirect(
{required FastPlacement placement, Duration timeout = const Duration(seconds: 30)}) → Future - 直接展示广告,等待加载完成后展示
-
toString(
) → String -
A string representation of this object.
inherited
-
triggerCallback(
void callback(FastAdUnitInterceptor, FastAdUnit)) → void - 统一触发所有拦截器的回调(包含 adUnit)
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited