toJson method

dynamic toJson()

Converts the InvoiceLine instance into a JSON map.

This method generates a map representation of the invoice line, which can be used for serializing the object into JSON format for APIs or storage. Example:

{
  "id": "1",
  "price": "100.00",
  "quantity": "2",
  "total": "200.00",
  "tax": { ... } // JSON representation of TaxDetails
}

Implementation

toJson() {
  return {
    'id': id,
    'price': price,
    'quantity': quantity,
    'total': total,
    'tax': tax.toJson() // Assuming `TaxDetails` has a `toJson` method.
  };
}