NativeAdController class Null safety

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:



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


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


attach([bool attach = true]) → void
Attach the controller to an Ad Throws an AssertionException if the controller is already attached.
@mustCallSuper, 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
ensureAdAvailable() → void
@protected, inherited
ensureAdNotDisposed() → void
@protected, inherited
init() → void
Initialize the controller. This can be called only by the controller
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.
muteThisAd([int? reason]) Future<void>
Mutes This Ad programmatically.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
show() Future<bool>
toString() String
A string representation of this object.


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

Static Properties

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