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

45 lines
958 B
Dart
Raw Normal View History

2020-10-15 03:06:13 +06:30
class CustomDuty {
2021-09-10 14:27:38 +06:30
String? id;
String? productType;
String? desc;
2020-10-15 03:06:13 +06:30
double fee;
double shipmentRate;
CustomDuty(
2021-09-10 14:27:38 +06:30
{this.id,
this.productType,
this.desc,
this.fee = 0,
this.shipmentRate = 0});
2020-10-15 03:06:13 +06:30
factory CustomDuty.fromMap(Map<String, dynamic> map, String id) {
return CustomDuty(
id: id,
productType: map['product_type'],
desc: map['desc'],
fee: (map['fee'] ?? 0).toDouble(),
);
}
Map<String, dynamic> toMap() {
return {
"id": id,
'product_type': productType,
'desc': desc,
'fee': fee,
};
}
2020-10-22 04:14:53 +06:30
@override
bool operator ==(Object other) => other is CustomDuty && other.id == id;
@override
int get hashCode => id.hashCode;
bool isChangedForEdit(CustomDuty customDuty) {
return customDuty.productType != this.productType ||
customDuty.fee != this.fee
// ||customDuty.shipmentRate != this.shipmentRate
;
}
2020-10-15 03:06:13 +06:30
}