NativeAd class

A NativeAd.

Native ads are ad assets that are presented to users via UI components that are native to the platform. (e.g. A View on Android or a UIView on iOS). Using Flutter widgets to create native ads is NOT supported by this.

Using platform specific UI components, these ads can be formatted to match the visual design of the user experience in which they live. In coding terms, this means that when a native ad loads, your app receives a NativeAd object that contains its assets, and the app (rather than the Google Mobile Ads SDK) is then responsible for displaying them.

See the README for more details on using Native Ads.

To display this ad, instantiate an AdWidget with this as a parameter after calling load.

Inheritance

Constructors

NativeAd({required String adUnitId, required String factoryId, required AdListener listener, required AdRequest? request, Map<String, Object>? customOptions})
Creates a NativeAd.
NativeAd.fromPublisherRequest({required String adUnitId, required String factoryId, required AdListener listener, required PublisherAdRequest? publisherRequest, Map<String, Object>? customOptions})
Creates a NativeAd with Ad Manager.

Properties

adUnitId String
Identifies the source of Ads for your application.
finalinherited
customOptions Map<String, Object>?
Optional options used to create the NativeAd.
getter/setter pair
factoryId String
An identifier for the factory that creates the Platform view.
final
hashCode int
The hash code for this object.
no setterinherited
listener AdListener
Receive callbacks from Ad lifecycle events.
finalinherited
publisherRequest PublisherAdRequest?
Targeting information used to fetch an Ad with Ad Manager.
final
request AdRequest?
Targeting information used to fetch an Ad.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() Future<void>
Free the plugin resources associated with this ad.
inherited
isLoaded() Future<bool>
Whether this Ad.load has been called for this Ad and AdListener.onAdLoaded callback has been called.
inherited
load() Future<void>
Start loading this ad.
override
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 Properties

testAdUnitId String
A platform-specific AdMob test ad unit ID.
final