showAd method
Widget
showAd({
- required Map<
String, dynamic> adData, - required Widget contentView,
- void onAdClick()?,
- void onViewAppeared()?,
override
Creates a native ad widget with the specified configuration.
adData - Required ad metadata to display the native ad
contentView - Required custom content view
onAdClick - Optional callback triggered when the ad is clicked
onViewAppeared - Optional callback triggered when the ad appears
Returns a Widget that displays the native advertisement
Implementation
@override
Widget showAd({
required Map<String, dynamic> adData,
required Widget contentView,
void Function(Map)? onAdClick,
void Function(Map, String)? onViewAppeared,
}) {
return NativeAdView(
ad: adData,
contentView: contentView,
onAdClicked: onAdClick != null ? (ad) => onAdClick(ad) : null,
onAdLoaded:
onViewAppeared != null ? (ad) => onViewAppeared(ad, '') : null,
config: _config,
);
}