encode<V> static method

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

Implementation

static V encode<V>(
  BillingPortalSessionFlow instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  PortalFlowsFlowAfterCompletion.encode(
    instance.afterCompletion,
    container.nestedSingleValueContainer('after_completion').encoder,
  );
  if (instance.subscriptionCancel != null) {
    BillingPortalSessionFlowSubscriptionCancel.encode(
      instance.subscriptionCancel!,
      container.nestedSingleValueContainer('subscription_cancel').encoder,
    );
  }
  if (instance.subscriptionUpdate != null) {
    BillingPortalSessionFlowSubscriptionUpdate.encode(
      instance.subscriptionUpdate!,
      container.nestedSingleValueContainer('subscription_update').encoder,
    );
  }
  if (instance.subscriptionUpdateConfirm != null) {
    BillingPortalSessionFlowSubscriptionUpdateConfirm.encode(
      instance.subscriptionUpdateConfirm!,
      container
          .nestedSingleValueContainer('subscription_update_confirm')
          .encoder,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  return container.value;
}