AdUtils class

Utility class for loading ads using Google Mobile Ads.

Provides helper methods to create and load Banner and Native ads.

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

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

getAdSizeType(int index, {int interval = 7}) → AdSizeType?
Returns the ad type for a given index if it should be an ad, otherwise null.
getAnchoredAdaptiveBannerAdSize(BuildContext context) → Future<AdSize?>
Calculates the anchored adaptive banner size for the current screen width.
getDataIndex(int listIndex, {int interval = 7}) → int
Calculates the actual item index in the original data list, adjusting for interleaved ads.
getTotalCount(int dataLength, {int interval = 7}) → int
Calculates the total count of items in the ListView (data + ads).
loadAd(String id, {AdSize size = AdSize.largeBanner, void onLoaded()?}) → BannerAd
Loads a BannerAd with the given id.
loadAnchoredAdaptiveBanner(String id, AdSize size, {void onLoaded()?}) → BannerAd
Loads an anchored adaptive banner ad.
loadAppOpenAd(String id, {required void onAdClosed()}) → void
Loads an AppOpenAd with the given id.
loadMrecAd(String id, {void onLoaded()?}) → BannerAd
Loads an MREC (Medium Rectangle) ad.
supportAd() → bool
Checks if the current platform supports ads.