NativeAdListener constructor
NativeAdListener({
- AdEventCallback? onAdLoaded,
- dynamic onAdFailedToLoad(
- Ad ad,
- LoadAdError error
- AdEventCallback? onAdOpened,
- AdEventCallback? onAdWillDismissScreen,
- AdEventCallback? onAdClosed,
- AdEventCallback? onAdImpression,
- OnPaidEventCallback? onPaidEvent,
- AdEventCallback? onAdClicked,
Constructs a NativeAdListener with the provided event callbacks.
Typically you will override onAdLoaded
and onAdFailedToLoad
:
NativeAdListener(
onAdLoaded: (ad) {
// Ad successfully loaded - display an AdWidget with the native ad.
},
onAdFailedToLoad: (ad, error) {
// Ad failed to load - log the error and dispose the ad.
},
...
)
Implementation
NativeAdListener({
AdEventCallback? onAdLoaded,
Function(Ad ad, LoadAdError error)? onAdFailedToLoad,
AdEventCallback? onAdOpened,
AdEventCallback? onAdWillDismissScreen,
AdEventCallback? onAdClosed,
AdEventCallback? onAdImpression,
OnPaidEventCallback? onPaidEvent,
AdEventCallback? onAdClicked,
}) : super(
onAdLoaded: onAdLoaded,
onAdFailedToLoad: onAdFailedToLoad,
onAdOpened: onAdOpened,
onAdWillDismissScreen: onAdWillDismissScreen,
onAdClosed: onAdClosed,
onAdImpression: onAdImpression,
onPaidEvent: onPaidEvent,
onAdClicked: onAdClicked);