toJson method
Converts the InvoiceItem instance to a JSON map.
The method generates a map representation of the invoice item, which can be used for serializing the object into JSON for APIs or storage.
Example:
{
"description": "Laptop",
"quantity": 1,
"unitPrice": 1000.0,
"taxableAmount": 1000.0,
"vatRate": 5.0,
"vatAmount": 50.0
}
Implementation
Map<String, dynamic> toJson() => {
"description": description,
"quantity": quantity,
"unitPrice": unitPrice,
"taxableAmount": taxableAmount,
"vatRate": vatRate,
"vatAmount": vatAmount,
};