class CustomDuty { String id; String productType; String desc; double fee; CustomDuty({this.id, this.productType, this.desc, this.fee}); factory CustomDuty.fromMap(Map map, String id) { return CustomDuty( id: id, productType: map['product_type'], desc: map['desc'], fee: (map['fee'] ?? 0).toDouble(), ); } Map toMap() { return { "id": id, 'product_type': productType, 'desc': desc, 'fee': fee, }; } }