UserReward.fromJson constructor

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

Implementation

factory UserReward.fromJson(Map<String, dynamic> json) {
  log(json["delivery"].toString());
  return UserReward(
      id: json["id"],
      uid: json["uid"],
      createdAt: DateTime.tryParse(json["created_at"] ?? ""),
      couponCode: json["coupon_code"],
      delivery: json["delivery"] == null
          ? null
          : Delivery.fromJson(json["delivery"]),
      expiryAt: DateTime.tryParse(json["expiry_at"] ?? ""),
      note: json["note"],
      rewardId: json["reward_id"],
      rewardName: json["reward_name"],
      rewardQty: json["reward_qty"],
      rewardType: json["reward_type"],
      status: json["status"],
      taskId: json["task_id"],
      updatedAt: DateTime.tryParse(json["updated_at"] ?? ""),
      usedCount: json["used_count"],
      expiryText: json["expiry_text"]);
}