toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = id;
  data['uid'] = uId;
  data['title'] = title;
  data['description'] = description;
  data['createdAt'] = createdAt;
  if (featuredImage != null) {
    data['featuredImage'] = featuredImage!.toJson();
  }
  data['handle'] = handle;
  data['publishedAt'] = publishedAt;
  data['totalInventory'] = totalInventory;
  if (priceRange != null) {
    data['priceRange'] = priceRange!.toJson();
  }
  if (compareAtPriceRange != null) {
    data['compareAtPriceRange'] = compareAtPriceRange!.toJson();
  }
  data['productType'] = productType;
  if (variants != null) {
    data['variants'] = variants!.map((v) => v.toJson()).toList();
  }
  return data;
}