MediaContent class

Class used to tell the info about the media content of a Native Ad. It's usually used alongside NativeAdController. A media content is never null.

The Media Content can be an image or a video. If you're using test ads, video ads needs to be requested using the Native Video Test Ad Unit Id, which you can get by calling MobileAds.nativeAdVideoTestUnitId

Constructors

MediaContent({double? aspectRatio, Duration? duration, bool? hasVideoContent})
Creates a new MediaContent object
const

Properties

aspectRatio double?
The aspect ratio of the media content, which can be an image or a video. This usually corresponds to the aspect ratio set in options (NativeAdOptions):
final
duration Duration?
The duration of the video, if avaiable
final
hashCode int
The hash code for this object.
no setterinherited
hasVideoContent bool?
Indicates whether the media content has video content (true) or not (false).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith(MediaContent content) MediaContent
Copy this with the values from a new MediaContent
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 Methods

fromJson(dynamic map) MediaContent
Creates a new MediaContent object based on a json.