toJson method
Implementation
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = {};
data['id'] = id;
data['selected'] = selected;
data['label'] = label;
if (type == ShippingMethodType.shipping) {
_type = 'SHIPPING';
} else if (type == ShippingMethodType.pickup) {
_type = 'PICKUP';
} else if (type == ShippingMethodType.shippingAndPickup) {
_type = 'SHIPPING_AND_PICKUP';
} else {
_type = 'unknown';
}
data['type'] = _type;
if (amount != null) {
data['amount'] = amount!.toJson();
}
return data;
}