encode<V> static method

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

Implementation

static V encode<V>(
  TransactionLineItemsItem instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeInt(
    'amount',
    instance.amount,
  );
  container.encodeInt(
    'amount_tax',
    instance.amountTax,
  );
  if (instance.metadata != null) {
    container.encodeMap(
      'metadata',
      (container) => instance.metadata!.forEach((
        key,
        value,
      ) =>
          container.encodeString(
            key,
            value,
          )),
    );
  }
  container.encodeString(
    'original_line_item',
    instance.originalLineItem,
  );
  if (instance.quantity != null) {
    container.encodeInt(
      'quantity',
      instance.quantity!,
    );
  }
  container.encodeString(
    'reference',
    instance.reference,
  );
  return container.value;
}