encode<V> static method

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

Implementation

static V encode<V>(
  ReaderCart instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeString(
    'currency',
    instance.currency,
  );
  container.encodeList(
    'line_items',
    (container) => instance.lineItems
        .forEach((el) => TerminalReaderReaderResourceLineItem.encode(
              el,
              container.nestedSingleValueContainer().encoder,
            )),
  );
  if (instance.tax != null) {
    container.encodeInt(
      'tax',
      instance.tax!,
    );
  }
  container.encodeInt(
    'total',
    instance.total,
  );
  return container.value;
}