AdRequest class

Targeting parameters attached to a single ad request.

Maps to the GMA Next-Gen SDK's AdRequest.Builder / BannerAdRequest.Builder configuration methods (addKeyword, setContentUrl, putCustomTargeting, etc.). All fields are optional — pass const AdRequest() if you have no targeting hints.

const request = AdRequest(
  keywords: ['flutter', 'mobile-dev'],
  contentUrl: 'https://example.com/article',
  customTargeting: {'genre': ['action', 'adventure']},
);
final ad = await InterstitialAd.load(adUnitId: '...', request: request);

Constructors

AdRequest({List<String> keywords = const <String>[], Map<String, List<String>> customTargeting = const <String, List<String>>{}, String? contentUrl, Set<String> neighboringContentUrls = const <String>{}, String? requestAgent, List<String> categoryExclusions = const <String>[], String? publisherProvidedId})
const

Properties

categoryExclusions List<String>
Category exclusion labels (configured in AdMob console).
final
contentUrl String?
URL of the content the ad is anchored to (e.g. the article being read).
final
customTargeting Map<String, List<String>>
Key-value targeting. Each key maps to one or more values.
final
hashCode int
The hash code for this object.
no setterinherited
keywords List<String>
Keywords describing the content the ad is shown alongside.
final
neighboringContentUrls Set<String>
Up to 4 URLs adjacent to the primary content. Helps the SDK pick contextually relevant ads.
final
publisherProvidedId String?
Pre-supplied unique publisher-provided ID (used for some advanced targeting flows). Most apps can leave this null.
final
requestAgent String?
Identifies the requesting party (e.g. 'my_app_v1.2'). Used for SDK analytics / debugging — not for monetization.
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
toMap() Map<String, dynamic>
Convert to the wire format consumed by the Kotlin plugin.
toString() String
A string representation of this object.
inherited

Operators

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