42 lines
1013 B
Dart
42 lines
1013 B
Dart
class ProductStockModel {
|
|
final String productid;
|
|
final String name;
|
|
final String sku;
|
|
final int stock;
|
|
final int openingInventory;
|
|
|
|
ProductStockModel({
|
|
required this.productid,
|
|
required this.name,
|
|
required this.sku,
|
|
required this.stock,
|
|
required this.openingInventory,
|
|
});
|
|
|
|
factory ProductStockModel.fromJson(Map<String, dynamic> json) {
|
|
return ProductStockModel(
|
|
productid: json['productid']??"2323",
|
|
name: json['name']??"rert",
|
|
sku: json['SKU']??"",
|
|
stock: json['Stock']??"",
|
|
openingInventory: json['openingInventory']??""
|
|
);
|
|
}
|
|
|
|
// Convert a ProductStock instance to a JSON map
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'productid': productid,
|
|
'name': name,
|
|
'SKU': sku,
|
|
'Stock': stock,
|
|
'openingInventory':openingInventory
|
|
};
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return 'ProductStock(productid: $productid, name: $name, sku: $sku, stock: $stock,openingInventory:$openingInventory)';
|
|
}
|
|
}
|