encode<V> static method
Implementation
static V encode<V>(
CreditNoteLinesItem instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.amount != null) {
container.encodeInt(
'amount',
instance.amount!,
);
}
if (instance.description != null) {
container.encodeString(
'description',
instance.description!,
);
}
if (instance.invoiceLineItem != null) {
container.encodeString(
'invoice_line_item',
instance.invoiceLineItem!,
);
}
if (instance.quantity != null) {
container.encodeInt(
'quantity',
instance.quantity!,
);
}
if (instance.taxAmounts != null) {
container.encodeList(
'tax_amounts',
(container) => instance.taxAmounts!
.forEach((el) => CreditNoteTaxAmountsItem.encode(
el,
container.nestedSingleValueContainer().encoder,
)),
);
}
if (instance.taxRates != null) {
container.encodeList(
'tax_rates',
(container) =>
instance.taxRates!.forEach((el) => container.encodeString(el)),
);
}
CreditNoteLineItemType.encode(
instance.type,
container.nestedSingleValueContainer('type').encoder,
);
if (instance.unitAmount != null) {
container.encodeInt(
'unit_amount',
instance.unitAmount!,
);
}
if (instance.unitAmountDecimal != null) {
container.encodeString(
'unit_amount_decimal',
instance.unitAmountDecimal!,
);
}
return container.value;
}