encode<V> static method

V encode<V>(
  1. CalculationLineItemsItem instance,
  2. Encoder<V> encoder
)

Implementation

static V encode<V>(
  CalculationLineItemsItem instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeInt(
    'amount',
    instance.amount,
  );
  if (instance.product != null) {
    container.encodeString(
      'product',
      instance.product!,
    );
  }
  if (instance.quantity != null) {
    container.encodeInt(
      'quantity',
      instance.quantity!,
    );
  }
  if (instance.reference != null) {
    container.encodeString(
      'reference',
      instance.reference!,
    );
  }
  if (instance.taxBehavior != null) {
    TaxCalculationShippingCostTaxBehavior.encode(
      instance.taxBehavior!,
      container.nestedSingleValueContainer('tax_behavior').encoder,
    );
  }
  if (instance.taxCode != null) {
    container.encodeString(
      'tax_code',
      instance.taxCode!,
    );
  }
  return container.value;
}