encode<V> static method

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

Implementation

static V encode<V>(
  SessionLineItemsItem instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.adjustableQuantity != null) {
    SessionAdjustableQuantity.encode(
      instance.adjustableQuantity!,
      container.nestedSingleValueContainer('adjustable_quantity').encoder,
    );
  }
  if (instance.dynamicTaxRates != null) {
    container.encodeList(
      'dynamic_tax_rates',
      (container) => instance.dynamicTaxRates!
          .forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.price != null) {
    container.encodeString(
      'price',
      instance.price!,
    );
  }
  if (instance.priceData != null) {
    SessionPriceData.encode(
      instance.priceData!,
      container.nestedSingleValueContainer('price_data').encoder,
    );
  }
  if (instance.quantity != null) {
    container.encodeInt(
      'quantity',
      instance.quantity!,
    );
  }
  if (instance.taxRates != null) {
    container.encodeList(
      'tax_rates',
      (container) =>
          instance.taxRates!.forEach((el) => container.encodeString(el)),
    );
  }
  return container.value;
}