toJson method
Converts the SimplifiedInvoice object to a JSON format.
This method returns the invoice details as a map of key-value pairs that represent the JSON structure. It includes details such as the ID, issue date, issue time, customer, tax information, and invoice lines.
Returns a Map<String, dynamic> representing the invoice in JSON format.
Implementation
Map<String, dynamic> toJson() {
return {
"id": id,
"uuid": uuid,
"issueDate": issueDate.toIso8601String().split('T')[0],
"issuedTime": issueTime.toIso8601String().split('T')[1].split('.')[0],
"currency": currency,
"supplier": supplier,
"customer": customer,
"lines": lines.map((item) => item.toJson()).toList(),
"tax": tax.toJson(),
};
}