AdUnitId class

Platform-specific ad unit ID pair.

Holds separate ad unit IDs for Android and iOS. In debug builds, the resolved getter automatically substitutes Google's official test ad IDs so that real ads are never served during development.

final bannerId = AdUnitId(
  android: 'ca-app-pub-xxxxx/banner-android',
  ios: 'ca-app-pub-xxxxx/banner-ios',
);

// In debug: returns Google test ID
// In release: returns your production ID
print(bannerId.resolved);

Constructors

AdUnitId({required String android, required String ios})
Creates a platform-specific ad unit ID pair.
const

Properties

android String
The ad unit ID for Android.
final
hashCode int
The hash code for this object.
no setteroverride
ios String
The ad unit ID for iOS.
final
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
resolved({AdType adType = AdType.banner}) String
Returns the ad unit ID for the current platform.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override

Constants

testAppOpenAndroid → const String
Google's official test app-open ad ID for Android.
testAppOpenIos → const String
Google's official test app-open ad ID for iOS.
testBannerAndroid → const String
Google's official test banner ad ID for Android.
testBannerIos → const String
Google's official test banner ad ID for iOS.
testInterstitialAndroid → const String
Google's official test interstitial ad ID for Android.
testInterstitialIos → const String
Google's official test interstitial ad ID for iOS.
testRewardedAndroid → const String
Google's official test rewarded ad ID for Android.
testRewardedIos → const String
Google's official test rewarded ad ID for iOS.