showAd method

  1. @override
Widget showAd({
  1. required Map<String, dynamic> adData,
  2. required Widget contentView,
  3. void onAdClick(
    1. Map
    )?,
  4. void onViewAppeared(
    1. Map,
    2. String
    )?,
})
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,
  );
}