ProductData.fromJson constructor

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

Implementation

factory ProductData.fromJson(Map<String, dynamic> json) => ProductData(
    id: json["id"] == null ? null : json["id"],
    merchantId: json["merchant_id"] == null ? null : json["merchant_id"],
    uuid: json["uuid"] == null ? null : json["uuid"],
    name: json["name"] == null ? null : json["name"],
    sku: json["sku"] == null ? null : json["sku"],
    price: json["price"] == null ? null : json["price"],
    description: json["description"] == null ? null : json["description"],
    quantity: json["quantity"] == null ? null : json["quantity"],
    thankYouUrl: json["thank_you_url"] == null ? null : json["thank_you_url"],
    categoryId: json["category_id"],
    sortOrder: json["sort_order"] == null ? null : json["sort_order"],
    shippingFee: json["shipping_fee"],
    tax: json["tax"],
    type: json["type"] == null ? null : json["type"],
    meta: json["meta"] == null ? null : json["meta"],
    status: json["status"] == null ? null : json["status"],
    deletedAt: json["deleted_at"],
    createdAt: json["created_at"] == null ? null : DateTime.parse(json["created_at"]),
    updatedAt: json["updated_at"] == null ? null : DateTime.parse(json["updated_at"]),
    numberSold: json["number_sold"] == null ?  null : json["number_sold"],
    assets: json["assets"] == null ? null : List<Asset>.from(json["assets"].map((x) => Asset.fromJson(x))),
    orders: json["orders"] == null ? null : List<OrderData>.from(json["orders"].map((x) => OrderData.fromJson(x))),
);