MediaV2 class

Represents media elements uploaded with the Tweet. In twitter API V2 media is no longer treated as entity, but as attachment.

Media refers to any image, GIF, or video attached to a Tweet. The media object is not a primary object on any endpoint, but can be found and expanded in the Tweet object.

The object is available for expansion with ?expansions=attachments.media_keys to get the condensed object with only default fields. Use the expansion with the field parameter: media.fields when requesting additional fields to complete the object.

Annotations
  • @JsonSerializable()

Constructors

MediaV2({required String mediaKey, required String type, String? url, int? height, int? width, double? durationMilliseconds, String? previewImageUrl})
const
MediaV2.fromJson(Map<String, dynamic> json)
factory
MediaV2.fromRawJson(String str)
factory

Properties

durationMilliseconds double?
Available when type is video. Duration in milliseconds of the video.
final
hashCode int
The hash code for this object.
no setterinherited
height int?
Height of this content in pixels.
final
mediaKey String
The key (id) of the media. It is used to find a proper media object in TweetV2Response::includes::media list
final
previewImageUrl String?
URL to the static placeholder preview of this content.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type String
Type of the media content. Possible types include photo, video, and animated_gif
final
url String?
Url of the content This field is not directly listed in Twitter API reference, but seems like can be attached to the actual response When provided it is used, otherwise previewImageUrl will be used to fetch content.
final
width int?
Width of this content in pixels.
final

Methods

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