toJson method
Converts this Order object into a JSON object.
The resulting JSON will follow the same format as required by Order.fromJson.
Implementation
Map<String, dynamic> toJson() {
return {
'items': items.map((item) => item.toJson()).toList(),
'subtotal': subtotal,
'tax': tax,
'total': total,
'invoice_number': invoiceNumber,
'date': date,
'payment_method': paymentMethod.toUpperCase(),
};
}