169 lines
4.0 KiB
Dart
169 lines
4.0 KiB
Dart
class ProductResponse {
|
|
bool? success;
|
|
int? totalData;
|
|
int? totalPages;
|
|
List<Products>? products;
|
|
|
|
ProductResponse(
|
|
{this.success, this.totalData, this.totalPages, this.products});
|
|
|
|
ProductResponse.fromJson(Map<String, dynamic> json) {
|
|
success = json['success'];
|
|
totalData = json['total_data'];
|
|
totalPages = json['total_pages'];
|
|
if (json['products'] != null) {
|
|
products = <Products>[];
|
|
json['products'].forEach((v) {
|
|
products!.add(new Products.fromJson(v));
|
|
});
|
|
}
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
data['success'] = this.success;
|
|
data['total_data'] = this.totalData;
|
|
data['total_pages'] = this.totalPages;
|
|
if (this.products != null) {
|
|
data['products'] = this.products!.map((v) => v.toJson()).toList();
|
|
}
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class Products {
|
|
String? sId;
|
|
String? sKU;
|
|
String? name;
|
|
Category? category;
|
|
int? price;
|
|
GST? gST;
|
|
String? description;
|
|
String? specialInstructions;
|
|
String? productStatus;
|
|
AddedBy? addedBy;
|
|
List<Null>? image;
|
|
String? createdAt;
|
|
String? updatedAt;
|
|
int? iV;
|
|
|
|
Products(
|
|
{this.sId,
|
|
this.sKU,
|
|
this.name,
|
|
this.category,
|
|
this.price,
|
|
this.gST,
|
|
this.description,
|
|
this.specialInstructions,
|
|
this.productStatus,
|
|
this.addedBy,
|
|
this.image,
|
|
this.createdAt,
|
|
this.updatedAt,
|
|
this.iV});
|
|
|
|
Products.fromJson(Map<String, dynamic> json) {
|
|
sId = json['_id'];
|
|
sKU = json['SKU'];
|
|
name = json['name'];
|
|
category = json['category'] != null
|
|
? new Category.fromJson(json['category'])
|
|
: null;
|
|
price = json['price'];
|
|
gST = json['GST'] != null ? new GST.fromJson(json['GST']) : null;
|
|
description = json['description'];
|
|
specialInstructions = json['special_instructions'];
|
|
productStatus = json['product_Status'];
|
|
addedBy =
|
|
json['addedBy'] != null ? new AddedBy.fromJson(json['addedBy']) : null;
|
|
createdAt = json['createdAt'];
|
|
updatedAt = json['updatedAt'];
|
|
iV = json['__v'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
data['_id'] = this.sId;
|
|
data['SKU'] = this.sKU;
|
|
data['name'] = this.name;
|
|
if (this.category != null) {
|
|
data['category'] = this.category!.toJson();
|
|
}
|
|
data['price'] = this.price;
|
|
if (this.gST != null) {
|
|
data['GST'] = this.gST!.toJson();
|
|
}
|
|
data['description'] = this.description;
|
|
data['special_instructions'] = this.specialInstructions;
|
|
data['product_Status'] = this.productStatus;
|
|
if (this.addedBy != null) {
|
|
data['addedBy'] = this.addedBy!.toJson();
|
|
}
|
|
data['createdAt'] = this.createdAt;
|
|
data['updatedAt'] = this.updatedAt;
|
|
data['__v'] = this.iV;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class Category {
|
|
String? sId;
|
|
String? categoryName;
|
|
|
|
Category({this.sId, this.categoryName});
|
|
|
|
Category.fromJson(Map<String, dynamic> json) {
|
|
sId = json['_id'];
|
|
categoryName = json['categoryName'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
data['_id'] = this.sId;
|
|
data['categoryName'] = this.categoryName;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class GST {
|
|
String? sId;
|
|
String? name;
|
|
int? tax;
|
|
|
|
GST({this.sId, this.name, this.tax});
|
|
|
|
GST.fromJson(Map<String, dynamic> json) {
|
|
sId = json['_id'];
|
|
name = json['name'];
|
|
tax = json['tax'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
data['_id'] = this.sId;
|
|
data['name'] = this.name;
|
|
data['tax'] = this.tax;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class AddedBy {
|
|
String? sId;
|
|
String? name;
|
|
|
|
AddedBy({this.sId, this.name});
|
|
|
|
AddedBy.fromJson(Map<String, dynamic> json) {
|
|
sId = json['_id'];
|
|
name = json['name'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
data['_id'] = this.sId;
|
|
data['name'] = this.name;
|
|
return data;
|
|
}
|
|
}
|