encode<V> static method

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

Implementation

static V encode<V>(
  PaymentPagesCheckoutSessionCustomFields instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.dropdown != null) {
    PaymentPagesCheckoutSessionCustomFieldsDropdown.encode(
      instance.dropdown!,
      container.nestedSingleValueContainer('dropdown').encoder,
    );
  }
  container.encodeString(
    'key',
    instance.key,
  );
  PaymentPagesCheckoutSessionCustomFieldsLabel.encode(
    instance.label,
    container.nestedSingleValueContainer('label').encoder,
  );
  if (instance.numeric != null) {
    PaymentPagesCheckoutSessionCustomFieldsNumeric.encode(
      instance.numeric!,
      container.nestedSingleValueContainer('numeric').encoder,
    );
  }
  container.encodeBool(
    'optional',
    instance.optional,
  );
  if (instance.text != null) {
    PaymentPagesCheckoutSessionCustomFieldsText.encode(
      instance.text!,
      container.nestedSingleValueContainer('text').encoder,
    );
  }
  PaymentLinksResourceCustomFieldsType.encode(
    instance.type,
    container.nestedSingleValueContainer('type').encoder,
  );
  return container.value;
}