GiphyImage.fromJson constructor
Creates a GiphyImage instance from a JSON object.
json
A map containing key-value pairs corresponding to the image attributes.
Returns a GiphyImage instance populated with the values from the JSON object.
Implementation
factory GiphyImage.fromJson(Map<Object?, Object?> json) {
return GiphyImage(
gifUrl: json['gifUrl'] as String?,
width: json['width'] as int? ?? 0,
height: json['height'] as int? ?? 0,
gifSize: json['gifSize'] as int? ?? 0,
frames: json['frames'] as int? ?? 0,
mp4Url: json['mp4Url'] as String?,
mp4Size: json['mp4Size'] as int? ?? 0,
webPUrl: json['webPUrl'] as String?,
webPSize: json['webPSize'] as int? ?? 0,
mediaId: json['mediaId'] as String?,
renditionType: json['renditionType'] != null
? GiphyRenditionUtil.fromStringValue(json['renditionType'] as String)
as GiphyRendition?
: null,
);
}