Files
fcs/lib/domain/entities/discount_by_weight.dart

29 lines
669 B
Dart
Raw Normal View History

2020-10-15 03:06:13 +06:30
class DiscountByWeight {
2021-09-10 14:27:38 +06:30
String? id;
2020-10-15 03:06:13 +06:30
double weight;
double discount;
2021-09-10 14:27:38 +06:30
DiscountByWeight({this.id, this.weight = 0, this.discount = 0});
2020-10-15 03:06:13 +06:30
factory DiscountByWeight.fromMap(Map<String, dynamic> map, String id) {
return DiscountByWeight(
id: id,
weight: (map['weight'] ?? 0).toDouble(),
discount: (map['discount'] ?? 0).toDouble(),
);
}
Map<String, dynamic> toMap() {
return {
"id": id,
'weight': weight,
'discount': discount,
};
}
bool isChangedForEdit(DiscountByWeight discountByWeight) {
return discountByWeight.weight != this.weight ||
discountByWeight.discount != this.discount;
}
2020-10-15 03:06:13 +06:30
}