PexelPhotoModel.fromJson constructor

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

Implementation

PexelPhotoModel.fromJson(Map<String, dynamic> json) {
  if (json["id"] is int) id = json["id"];
  if (json["width"] is int) width = json["width"];
  if (json["height"] is int) height = json["height"];
  if (json["url"] is String) url = json["url"];
  if (json["photographer"] is String) photographer = json["photographer"];
  if (json["photographer_url"] is String) photographerUrl = json["photographer_url"];
  if (json["photographer_id"] is int) photographerId = json["photographer_id"];
  if (json["avg_color"] is String) avgColor = json["avg_color"];
  if (json["src"] is Map) src = json["src"] == null ? null : Src.fromJson(json["src"]);
  if (json["liked"] is bool) liked = json["liked"];
}