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