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, String? factoryId, required NativeAdListener listener, required AdRequest? request, NativeAdOptions? nativeAdOptions, Map<String, Object>? customOptions, NativeTemplateStyle? nativeTemplateStyle})
Creates a NativeAd.
NativeAd.fromAdManagerRequest({required String adUnitId, String? factoryId, required NativeAdListener listener, required AdManagerAdRequest? adManagerRequest, NativeAdOptions? nativeAdOptions, Map<String, Object>? customOptions, NativeTemplateStyle? nativeTemplateStyle})
Creates a NativeAd with Ad Manager.

Properties

adManagerRequest AdManagerAdRequest?
Targeting information used to fetch an Ad with Ad Manager.
final
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 NativeAdListener
A listener for receiving events in the ad lifecycle.
final
nativeAdOptions NativeAdOptions?
Options to configure the native ad request.
final
nativeTemplateStyle NativeTemplateStyle?
Optional NativeTemplateStyle for this ad.
final
request AdRequest?
Targeting information used to fetch an Ad.
final
responseInfo ResponseInfo?
Contains information about the loaded request.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() Future<void>
Frees the plugin resources associated with this ad.
inherited
load() Future<void>
Starts 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