first commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import 'package:enaklo_pos/data/models/response/product_response_model.dart';
|
||||
|
||||
import 'product_model.dart';
|
||||
|
||||
class OrderItem {
|
||||
final Product product;
|
||||
int quantity;
|
||||
OrderItem({
|
||||
required this.product,
|
||||
required this.quantity,
|
||||
});
|
||||
|
||||
factory OrderItem.fromMap(Map<String, dynamic> map) {
|
||||
return OrderItem(
|
||||
product: Product.fromMap(map['product']),
|
||||
quantity: map['quantity']?.toInt() ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other is OrderItem &&
|
||||
other.product == product &&
|
||||
other.quantity == quantity;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => product.hashCode ^ quantity.hashCode;
|
||||
}
|
||||
Reference in New Issue
Block a user