GiphyVideo.fromJson constructor

GiphyVideo.fromJson(
  1. Map<Object?, Object?> json
)

Factory constructor to create a new GiphyVideo instance from a JSON map.

The json parameter must not be null.

Implementation

factory GiphyVideo.fromJson(Map<Object?, Object?> json) {
  return GiphyVideo(
    hlsManifestURL: json['hlsManifestURL'] as String?,
    dashManifestURL: json['dashManifestURL'] as String?,
    assets: json['assets'] != null
        ? GiphyAssets.fromJson(json['assets'] as Map<Object?, Object?>)
        : null,
    previews: json['previews'] != null
        ? GiphyVideoPreviews.fromJson(
            json['previews'] as Map<Object?, Object?>)
        : null,
    captions: json['captions'] != null
        ? GiphyVideoCaptions.fromJson(
            json['captions'] as Map<Object?, Object?>)
        : null,
    duration: json['duration'] != null
        ? (json['duration'] as num).toDouble()
        : null,
  );
}