NativeAdController class

An Native Ad Controller model to communicate with the model on the platform side. It gives you methods to help in the implementation and event tracking. It's supposed to work alongside NativeAd, the class used to show the ad in the UI and add it to the widget tree.

For more info, see:

Inheritance

Constructors

NativeAdController({String? unitId, Duration loadTimeout = kDefaultLoadTimeout, Duration timeout = kDefaultAdTimeout})
Creates a new native ad controller

Properties

advertiser String?
The advertiser that is announcing the ad. This may be null even if isAvailable is true.
no setter
body String?
The body text of the ad. If isAvailable is true, this is always non-null.
no setter
callToAction String?
The text of the button. If isAvailable is true, this is always non-null.
no setter
channel MethodChannel
Channel to communicate with controller
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
headline String?
The title text of the ad. If isAvailable is true, this is always non-null.
no setter
iconUri String?
The url of the icon image. This may be null even if isAvailable is true.
no setter
id String
The unique key of this class
no setterinherited
imagesUri List<String>?
The urls of the media. If isAvailable is true, this is always non-null.
no setter
isAttached bool
Check if the controller is attached to a NativeAd
no setter
isAvailable bool
Check if the time is available. If ad is not loaded, returns false If it has been the time of timeout since the last load, returns false
no setterinherited
isCustomMuteThisAdEnabled bool
Returns true if this ad can be muted programmatically. Use NativeAdOptions when loading the ad to request custom implementation of Mute This Ad.
no setter
isDisposed bool
Check if the ad is disposed. You can dispose the ad by calling ad.dispose()
no setterinherited
isLoaded bool
Check if the ad is loaded
getter/setter pairinherited
lastLoadedTime DateTime?
getter/setter pairinherited
loadTimeout Duration
The ad will stop loading after a specified time.
finalinherited
mediaContent MediaContent?
Provides media content information.
no setter
muteThisAdReasons List<String>
Returns Mute This Ad reasons available for this ad. Use these Strings for showing the user
no setter
nonPersonalizedAds bool
Whether non-personalized ads (ads that are not based on a user’s past behavior) should be enabled.
finalinherited
onEvent Stream<Map<NativeAdEvent, dynamic>>
Listen to the events the controller throws
no setteroverride
onEventController StreamController<Map<NativeAdEvent, dynamic>>
finalinherited
onVideoEvent Stream<Map<AdVideoEvent, dynamic>>
Listen to the video events the controller throws
no setter
price String?
The price of the product announced on the ad. This may be null even if isAvailable is true.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serverSideVerificationOptions ServerSideVerificationOptions?
Server Side Verification - Info such as userId and customData
finalinherited
store String?
The store that is announcing the product on the ad. This may be null even if isAvailable is true.
no setter
timeout Duration
The time the ad can be kept loaded.
finalinherited
unitId String?
The unit id used on this ad. Can be null
finalinherited

Methods

attach([bool attach = true]) → void
Attach the controller to an Ad Throws an AssertionException if the controller is already attached.
inherited
dispose() → void
Dispose the controller to free up resources. Once disposed, the controller can not be used anymore. If you try to use a disposed controller, an AssertionError is thrown
override
ensureAdAvailable() → void
inherited
ensureAdNotDisposed() → void
inherited
init() → void
Initialize the controller. This can be called only by the controller
override
load({String? unitId, NativeAdOptions? options, bool force = false, Duration? timeout, bool? nonPersonalizedAds, List<String> keywords = const []}) Future<bool>
Load the ad. If the controller is disposed or the Mobile Ads SDK (ADMOB SDK) is not initialized, an AssertionError is thrown.
override
muteThisAd([int? reason]) Future<void>
Mutes This Ad programmatically.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
show() Future<bool>
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

testUnitId String
The test id for this ad.
no setter
videoTestUnitId String
The video test id for this ad.
no setter