45 lines
958 B
Dart
45 lines
958 B
Dart
class CustomDuty {
|
|
String? id;
|
|
String? productType;
|
|
String? desc;
|
|
double fee;
|
|
double shipmentRate;
|
|
CustomDuty(
|
|
{this.id,
|
|
this.productType,
|
|
this.desc,
|
|
this.fee = 0,
|
|
this.shipmentRate = 0});
|
|
|
|
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,
|
|
};
|
|
}
|
|
|
|
@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
|
|
;
|
|
}
|
|
}
|