loadMrecAd static method

BannerAd loadMrecAd(
  1. String id, {
  2. void onLoaded()?,
})

Loads an MREC (Medium Rectangle) ad.

Implementation

static BannerAd loadMrecAd(String id, {void Function()? onLoaded}) {
  return BannerAd(
    adUnitId: id,
    size: AdSize.mediumRectangle,
    request: const AdRequest(),
    listener: BannerAdListener(
      onAdLoaded: (ad) => onLoaded?.call(),
      onAdFailedToLoad: (ad, error) {
        LoggerUtil.e('MREC ad failed to load: $error');
        ad.dispose();
      },
    ),
  )..load();
}