productdetails
This commit is contained in:
406
lib/src/data/product_details.dart
Normal file
406
lib/src/data/product_details.dart
Normal file
@@ -0,0 +1,406 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final productDetails = productDetailsFromJson(jsondynamic);
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:ffi';
|
||||
|
||||
ProductDetailsData productDetailsdataFromJson(dynamic str) =>
|
||||
ProductDetailsData.fromJson(json.decode(str));
|
||||
|
||||
dynamic productDetailsToJson(ProductDetailsData data) => json.encode(data.toJson());
|
||||
|
||||
class ProductDetailsData {
|
||||
Data? data;
|
||||
|
||||
ProductDetailsData({
|
||||
this.data,
|
||||
});
|
||||
|
||||
factory ProductDetailsData.fromJson(Map<dynamic, dynamic> json) => ProductDetailsData(
|
||||
data: Data.fromJson(json["data"]),
|
||||
);
|
||||
|
||||
Map<dynamic, dynamic> toJson() => {
|
||||
"data": data!.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class Data {
|
||||
dynamic id;
|
||||
dynamic name;
|
||||
dynamic description;
|
||||
dynamic additionalInfo;
|
||||
dynamic brand;
|
||||
dynamic basePrice;
|
||||
dynamic discountPrice;
|
||||
dynamic? stock;
|
||||
dynamic? quantity;
|
||||
dynamic unit;
|
||||
dynamic slug;
|
||||
dynamic averageRating;
|
||||
bool? isInStock;
|
||||
bool? isActive;
|
||||
DateTime? createdAt;
|
||||
DateTime? updatedAt;
|
||||
dynamic storeId;
|
||||
dynamic categoryId;
|
||||
dynamic productTypeId;
|
||||
dynamic timeSlotId;
|
||||
Store? store;
|
||||
Category? category;
|
||||
dynamic? productType;
|
||||
dynamic timeSlot;
|
||||
List<ProductImage>? productImages;
|
||||
List<dynamic>? productTags;
|
||||
List<dynamic>? zones;
|
||||
List<dynamic>? productReview;
|
||||
List<dynamic>? questions;
|
||||
List<CartItem>? cartItems;
|
||||
List<WishlistItem>? wishlistItem;
|
||||
List<dynamic>? applicableCoupons;
|
||||
bool? isInWishlist;
|
||||
|
||||
Data({
|
||||
this.id,
|
||||
this.name,
|
||||
this.description,
|
||||
this.additionalInfo,
|
||||
this.brand,
|
||||
this.basePrice,
|
||||
this.discountPrice,
|
||||
this.stock,
|
||||
this.quantity,
|
||||
this.unit,
|
||||
this.slug,
|
||||
this.averageRating,
|
||||
this.isInStock,
|
||||
this.isActive,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.storeId,
|
||||
this.categoryId,
|
||||
this.productTypeId,
|
||||
this.timeSlotId,
|
||||
this.store,
|
||||
this.category,
|
||||
this.productType,
|
||||
this.timeSlot,
|
||||
this.productImages,
|
||||
this.productTags,
|
||||
this.zones,
|
||||
this.productReview,
|
||||
this.questions,
|
||||
this.cartItems,
|
||||
this.wishlistItem,
|
||||
this.applicableCoupons,
|
||||
this.isInWishlist,
|
||||
});
|
||||
|
||||
factory Data.fromJson(Map<dynamic, dynamic> json) => Data(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
description: json["description"],
|
||||
additionalInfo: json["additionalInfo"],
|
||||
brand: json["brand"],
|
||||
basePrice: json["basePrice"],
|
||||
discountPrice: json["discountPrice"],
|
||||
stock: json["stock"],
|
||||
quantity: json["quantity"],
|
||||
unit: json["unit"],
|
||||
slug: json["slug"],
|
||||
averageRating: json["averageRating"],
|
||||
isInStock: json["isInStock"],
|
||||
isActive: json["isActive"],
|
||||
createdAt: DateTime.parse(json["createdAt"]),
|
||||
updatedAt: DateTime.parse(json["updatedAt"]),
|
||||
storeId: json["storeId"],
|
||||
categoryId: json["categoryId"],
|
||||
productTypeId: json["productTypeId"],
|
||||
timeSlotId: json["timeSlotId"],
|
||||
store: Store.fromJson(json["store"]),
|
||||
category: Category.fromJson(json["category"]),
|
||||
productType: json["productType"],
|
||||
timeSlot: json["timeSlot"],
|
||||
productImages: List<ProductImage>.from(
|
||||
json["productImages"].map((x) => ProductImage.fromJson(x))),
|
||||
productTags: List<dynamic>.from(json["productTags"].map((x) => x)),
|
||||
zones: List<dynamic>.from(json["zones"].map((x) => x)),
|
||||
productReview: List<dynamic>.from(json["ProductReview"].map((x) => x)),
|
||||
questions: List<dynamic>.from(json["questions"].map((x) => x)),
|
||||
cartItems: List<CartItem>.from(
|
||||
json["cartItems"].map((x) => CartItem.fromJson(x))),
|
||||
wishlistItem: List<WishlistItem>.from(
|
||||
json["WishlistItem"].map((x) => WishlistItem.fromJson(x))),
|
||||
applicableCoupons:
|
||||
List<dynamic>.from(json["applicableCoupons"].map((x) => x)),
|
||||
isInWishlist: json["isInWishlist"],
|
||||
);
|
||||
|
||||
Map<dynamic, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"description": description,
|
||||
"additionalInfo": additionalInfo,
|
||||
"brand": brand,
|
||||
"basePrice": basePrice,
|
||||
"discountPrice": discountPrice,
|
||||
"stock": stock,
|
||||
"quantity": quantity,
|
||||
"unit": unit,
|
||||
"slug": slug,
|
||||
"averageRating": averageRating,
|
||||
"isInStock": isInStock,
|
||||
"isActive": isActive,
|
||||
"createdAt": createdAt,
|
||||
"updatedAt": updatedAt,
|
||||
"storeId": storeId,
|
||||
"categoryId": categoryId,
|
||||
"productTypeId": productTypeId,
|
||||
"timeSlotId": timeSlotId,
|
||||
"store": store!.toJson(),
|
||||
"category": category!.toJson(),
|
||||
"productType": productType,
|
||||
"timeSlot": timeSlot,
|
||||
"productImages":
|
||||
List<dynamic>.from(productImages!.map((x) => x.toJson())),
|
||||
"productTags": List<dynamic>.from(productTags!.map((x) => x)),
|
||||
"zones": List<dynamic>.from(zones!.map((x) => x)),
|
||||
"ProductReview": List<dynamic>.from(productReview!.map((x) => x)),
|
||||
"questions": List<dynamic>.from(questions!.map((x) => x)),
|
||||
"cartItems": List<dynamic>.from(cartItems!.map((x) => x.toJson())),
|
||||
"WishlistItem":
|
||||
List<dynamic>.from(wishlistItem!.map((x) => x.toJson())),
|
||||
"applicableCoupons":
|
||||
List<dynamic>.from(applicableCoupons!.map((x) => x)),
|
||||
"isInWishlist": isInWishlist,
|
||||
};
|
||||
}
|
||||
|
||||
class CartItem {
|
||||
dynamic id;
|
||||
dynamic quantity;
|
||||
dynamic priceSnapshot;
|
||||
dynamic cartId;
|
||||
dynamic productId;
|
||||
dynamic storeId;
|
||||
DateTime? createdAt;
|
||||
DateTime? updatedAt;
|
||||
|
||||
CartItem({
|
||||
this.id,
|
||||
this.quantity,
|
||||
this.priceSnapshot,
|
||||
this.cartId,
|
||||
this.productId,
|
||||
this.storeId,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
factory CartItem.fromJson(Map<dynamic, dynamic> json) => CartItem(
|
||||
id: json["id"],
|
||||
quantity: json["quantity"],
|
||||
priceSnapshot: json["priceSnapshot"],
|
||||
cartId: json["cartId"],
|
||||
productId: json["productId"],
|
||||
storeId: json["storeId"],
|
||||
createdAt: DateTime.parse(json["createdAt"]),
|
||||
updatedAt: DateTime.parse(json["updatedAt"]),
|
||||
);
|
||||
|
||||
Map<dynamic, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"quantity": quantity,
|
||||
"priceSnapshot": priceSnapshot,
|
||||
"cartId": cartId,
|
||||
"productId": productId,
|
||||
"storeId": storeId,
|
||||
"createdAt": createdAt,
|
||||
"updatedAt": updatedAt,
|
||||
};
|
||||
}
|
||||
|
||||
class Category {
|
||||
dynamic id;
|
||||
dynamic name;
|
||||
dynamic description;
|
||||
dynamic image;
|
||||
dynamic slug;
|
||||
dynamic level;
|
||||
bool? isActive;
|
||||
DateTime? createdAt;
|
||||
DateTime? updatedAt;
|
||||
dynamic parentCategoryId;
|
||||
dynamic path;
|
||||
|
||||
Category({
|
||||
this.id,
|
||||
this.name,
|
||||
this.description,
|
||||
this.image,
|
||||
this.slug,
|
||||
this.level,
|
||||
this.isActive,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.parentCategoryId,
|
||||
this.path,
|
||||
});
|
||||
|
||||
factory Category.fromJson(Map<dynamic, dynamic> json) => Category(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
description: json["description"],
|
||||
image: json["image"],
|
||||
slug: json["slug"],
|
||||
level: json["level"],
|
||||
isActive: json["isActive"],
|
||||
createdAt: DateTime.parse(json["createdAt"]),
|
||||
updatedAt: DateTime.parse(json["updatedAt"]),
|
||||
parentCategoryId: json["parentCategoryId"],
|
||||
path: json["path"],
|
||||
);
|
||||
|
||||
Map<dynamic, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"description": description,
|
||||
"image": image,
|
||||
"slug": slug,
|
||||
"level": level,
|
||||
"isActive": isActive,
|
||||
"createdAt": createdAt,
|
||||
"updatedAt": updatedAt,
|
||||
"parentCategoryId": parentCategoryId,
|
||||
"path": path,
|
||||
};
|
||||
}
|
||||
|
||||
class ProductImage {
|
||||
dynamic id;
|
||||
dynamic url;
|
||||
bool? isDefault;
|
||||
dynamic productId;
|
||||
|
||||
ProductImage({
|
||||
this.id,
|
||||
this.url,
|
||||
this.isDefault,
|
||||
this.productId,
|
||||
});
|
||||
|
||||
factory ProductImage.fromJson(Map<dynamic, dynamic> json) => ProductImage(
|
||||
id: json["id"],
|
||||
url: json["url"],
|
||||
isDefault: json["isDefault"],
|
||||
productId: json["productId"],
|
||||
);
|
||||
|
||||
Map<dynamic, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"url": url,
|
||||
"isDefault": isDefault,
|
||||
"productId": productId,
|
||||
};
|
||||
}
|
||||
|
||||
class Store {
|
||||
dynamic id;
|
||||
dynamic storeName;
|
||||
dynamic storeDescription;
|
||||
dynamic officialPhoneNumber;
|
||||
dynamic storeAddress;
|
||||
dynamic gstNumber;
|
||||
dynamic gumastaNumber;
|
||||
dynamic storePicture;
|
||||
DateTime? createdAt;
|
||||
DateTime? updatedAt;
|
||||
dynamic vendorId;
|
||||
bool? isActive;
|
||||
dynamic couponId;
|
||||
|
||||
Store({
|
||||
this.id,
|
||||
this.storeName,
|
||||
this.storeDescription,
|
||||
this.officialPhoneNumber,
|
||||
this.storeAddress,
|
||||
this.gstNumber,
|
||||
this.gumastaNumber,
|
||||
this.storePicture,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.vendorId,
|
||||
this.isActive,
|
||||
this.couponId,
|
||||
});
|
||||
|
||||
factory Store.fromJson(Map<dynamic, dynamic> json) => Store(
|
||||
id: json["id"],
|
||||
storeName: json["storeName"],
|
||||
storeDescription: json["storeDescription"],
|
||||
officialPhoneNumber: json["officialPhoneNumber"],
|
||||
storeAddress: json["storeAddress"],
|
||||
gstNumber: json["gstNumber"],
|
||||
gumastaNumber: json["gumastaNumber"],
|
||||
storePicture: json["storePicture"],
|
||||
createdAt: DateTime.parse(json["createdAt"]),
|
||||
updatedAt: DateTime.parse(json["updatedAt"]),
|
||||
vendorId: json["vendorId"],
|
||||
isActive: json["isActive"],
|
||||
couponId: json["couponId"],
|
||||
);
|
||||
|
||||
Map<dynamic, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"storeName": storeName,
|
||||
"storeDescription": storeDescription,
|
||||
"officialPhoneNumber": officialPhoneNumber,
|
||||
"storeAddress": storeAddress,
|
||||
"gstNumber": gstNumber,
|
||||
"gumastaNumber": gumastaNumber,
|
||||
"storePicture": storePicture,
|
||||
"createdAt": createdAt,
|
||||
"updatedAt": updatedAt,
|
||||
"vendorId": vendorId,
|
||||
"isActive": isActive,
|
||||
"couponId": couponId,
|
||||
};
|
||||
}
|
||||
|
||||
class WishlistItem {
|
||||
dynamic id;
|
||||
dynamic wishlistId;
|
||||
dynamic productId;
|
||||
dynamic storeId;
|
||||
DateTime? createdAt;
|
||||
DateTime? updatedAt;
|
||||
|
||||
WishlistItem({
|
||||
this.id,
|
||||
this.wishlistId,
|
||||
this.productId,
|
||||
this.storeId,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
factory WishlistItem.fromJson(Map<dynamic, dynamic> json) => WishlistItem(
|
||||
id: json["id"],
|
||||
wishlistId: json["wishlistId"],
|
||||
productId: json["productId"],
|
||||
storeId: json["storeId"],
|
||||
createdAt: DateTime.parse(json["createdAt"]),
|
||||
updatedAt: DateTime.parse(json["updatedAt"]),
|
||||
);
|
||||
|
||||
Map<dynamic, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"wishlistId": wishlistId,
|
||||
"productId": productId,
|
||||
"storeId": storeId,
|
||||
"createdAt": createdAt,
|
||||
"updatedAt": updatedAt,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user