encode<V> static method

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

Implementation

static V encode<V>(
  InvoiceThresholdReason instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.amountGte != null) {
    container.encodeInt(
      'amount_gte',
      instance.amountGte!,
    );
  }
  container.encodeList(
    'item_reasons',
    (container) => instance.itemReasons
        .forEach((el) => InvoiceItemThresholdReason.encode(
              el,
              container.nestedSingleValueContainer().encoder,
            )),
  );
  return container.value;
}