GiphyGif.fromJson constructor

GiphyGif.fromJson(
  1. Map<String, dynamic> json
)

Creates a new GIF instance from json

Implementation

factory GiphyGif.fromJson(Map<String, dynamic> json) => GiphyGif(
      title: json['title'],
      type: json['type'],
      id: json['id'],
      slug: json['slug'],
      url: json['url'],
      bitlyUrl: json['bitly_url'] ?? json['bitly_gif_url'],
      embedUrl: json['embed_url'],
      username: json['username'],
      source: json['source'],
      rating: _toRating(json['rating']),
      contentUrl: json['content_url'],
      sourceTld: json['source_tld'],
      sourcePostUrl: json['source_post_url'],
      createDateTime: json['create_datetime'] == null
          ? null
          : DateTime.parse(json['create_datetime']),
      importDateTime: json['import_datetime'] == null
          ? null
          : DateTime.parse(json['import_datetime']),
      trendingDateTime: json['trending_datetime'] == null
          ? null
          : DateTime.parse(json['trending_datetime']),
      user: json['user'] == null ? null : GiphyUser.fromJson(json['user']),
      images: GiphyImages.fromJson(json['images']),
    );