AdTool class
Properties
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
initialize({required String bannerAdUnitId, required String interstitialAdUnitId, int? maxInterstitialAdCount, required VoidCallback onSuccess, required VoidCallback onFailed})
→ Future<void>
-
初始化广告SDK
在应用启动获取到网络权限之后调用
@param bannerAdUnitId Banner广告单元ID
@param interstitialAdUnitId 插屏广告单元ID
@param maxInterstitialAdCount 最大插屏广告显示次数,默认值为null
@param onSuccess 初始化成功回调
@param onFailed 初始化失败回调
-
loadBannerAd({AdSize size = AdSize.banner, VoidCallback? onLoadSuccess, dynamic onLoadFailed(String)?, VoidCallback? onAdOpened, VoidCallback? onAdClosed})
→ Future<BannerAd?>
-
加载Banner广告
@throws 该方法会抛出异常,请使用try-catch捕获
@param size 广告大小,默认值为AdSize.banner
@param extras 额外参数,默认值为null, 例如{"collapsible": "top"}
@param onLoadSuccess 广告加载成功回调,默认值为null
@param onLoadFailed 广告加载失败回调,默认值为null
@param onAdOpened 广告展开回调,默认值为null
@param onAdClosed 广告关闭回调,默认值为null
-
loadInterstitialAd({VoidCallback? onLoadSuccess, dynamic onLoadFailed(String)?, required VoidCallback onShow, required VoidCallback onClose, required VoidCallback onClick})
→ Future<void>
-
加载插页广告
@param onLoadSuccess 广告加载成功回调,默认值为null
@param onLoadFailed 广告加载失败回调,默认值为null
@param onShow 广告展示回调
@param onClose 广告关闭回调
@param onClick 广告点击回调
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
showInterstitialAd({VoidCallback? onLoadSuccess, dynamic onLoadFailed(String)?, required VoidCallback onShow, required VoidCallback onClose, required VoidCallback onClick})
→ void
-
显示插页广告
@param onLoadSuccess 广告加载成功回调,默认值为null
@param onLoadFailed 广告加载失败回调,默认值为null
@param onShow 广告展示回调
@param onClose 广告关闭回调
@param onClick 广告点击回调
-
toString()
→ String
-
A string representation of this object.
inherited