Skip to content

Commit ceae92f

Browse files
authored
Add files via upload
1 parent d1f0e01 commit ceae92f

2 files changed

Lines changed: 66 additions & 0 deletions

File tree

lib/models/order_model.dart

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
class OrderModel {
2+
final String orderId;
3+
final String productId;
4+
final String productName;
5+
final int price;
6+
final DateTime createdAt;
7+
final String status;
8+
9+
OrderModel({
10+
required this.orderId,
11+
required this.productId,
12+
required this.productName,
13+
required this.price,
14+
required this.createdAt,
15+
required this.status,
16+
});
17+
18+
Map<String, dynamic> toMap() {
19+
return {
20+
'orderId': orderId, // ✅ FIX
21+
'productId': productId,
22+
'productName': productName,
23+
'price': price,
24+
'createdAt': createdAt,
25+
'status': status,
26+
};
27+
}
28+
}

lib/models/product_model.dart

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
class Product {
2+
final String id;
3+
final String name;
4+
final int price;
5+
final int stock;
6+
final String imageUrl;
7+
final bool trending;
8+
9+
Product({
10+
required this.id,
11+
required this.name,
12+
required this.price,
13+
required this.stock,
14+
required this.imageUrl,
15+
required this.trending,
16+
});
17+
18+
factory Product.fromMap(String id, Map<String, dynamic> data) {
19+
return Product(
20+
id: id,
21+
name: data['name'],
22+
price: data['price'],
23+
stock: data['stock'],
24+
imageUrl: data['imageUrl'],
25+
trending: data['trending'] ?? false,
26+
);
27+
}
28+
29+
Map<String, dynamic> toMap() {
30+
return {
31+
'name': name,
32+
'price': price,
33+
'stock': stock,
34+
'imageUrl': imageUrl,
35+
'trending': trending,
36+
};
37+
}
38+
}

0 commit comments

Comments
 (0)