Files
fcs/lib/domain/entities/discount_by_weight.dart
2020-12-08 20:24:15 +06:30

29 lines
660 B
Dart

class DiscountByWeight {
String id;
double weight;
double discount;
DiscountByWeight({this.id, this.weight, this.discount});
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;
}
}