encode<V> static method

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

Implementation

static V encode<V>(
  SubscriptionCancelOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.cancellationDetails != null) {
    SubscriptionCancellationDetails.encode(
      instance.cancellationDetails!,
      container.nestedSingleValueContainer('cancellation_details').encoder,
    );
  }
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.invoiceNow != null) {
    container.encodeBool(
      'invoice_now',
      instance.invoiceNow!,
    );
  }
  if (instance.prorate != null) {
    container.encodeBool(
      'prorate',
      instance.prorate!,
    );
  }
  return container.value;
}