CalmModel.fromJson constructor

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

Implementation

CalmModel.fromJson(Map<String, dynamic> json) {
  if (json["id"] is String) this.id = json["id"];
  if (json["calmName"] is String) this.calmName = json["calmName"];
  if (json["pictureUrl"] is String) this.pictureUrl = json["pictureUrl"];
  if (json["videoUrl"] is String) this.videoUrl = json["videoUrl"];
  this.datetime = json["datetime"];
  if (json["isUniversal"] is int) this.isUniversal = json["isUniversal"];
  if (json["cardType"] is int) this.cardType = json["cardType"];
  if (json["duration"] is int) this.duration = json["duration"];
  if (json["price"] is double) this.price = json["price"];
  if (json["currency"] is String) this.currency = json["currency"];
  if (json["freeSampleFrom"] is int)
    this.freeSampleFrom = json["freeSampleFrom"];
  if (json["freeSampleTo"] is int) this.freeSampleTo = json["freeSampleTo"];
  this.rating = json["rating"];
  if (json["numberOfSubscriber"] is int)
    this.numberOfSubscriber = json["numberOfSubscriber"];
  if (json["category"] is Map)
    this.category =
        json["category"] == null ? null : CalmCate.fromJson(json["category"]);
  if (json["creator"] is Map)
    this.creator = json["creator"] == null
        ? null
        : CalmSubscriber.fromJson(json["category"]);
}