Some checks are pending
Flutter CI / build (push) Waiting to run
Co-authored-by: aider (ollama_chat/7b) <aider@aider.chat>
31 lines
612 B
Dart
31 lines
612 B
Dart
class Product {
|
|
final int? id;
|
|
final String name;
|
|
final double unitPrice;
|
|
final double discount;
|
|
|
|
Product({
|
|
this.id,
|
|
required this.name,
|
|
required this.unitPrice,
|
|
required this.discount,
|
|
});
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return {
|
|
'id': id,
|
|
'name': name,
|
|
'unit_price': unitPrice,
|
|
'discount': discount,
|
|
};
|
|
}
|
|
|
|
factory Product.fromMap(Map<String, dynamic> map) {
|
|
return Product(
|
|
id: map['id'] as int?,
|
|
name: map['name'] as String,
|
|
unitPrice: map['unit_price'] as double,
|
|
discount: map['discount'] as double,
|
|
);
|
|
}
|
|
}
|