encode<V> static method

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

Implementation

static V encode<V>(
  PaymentLinksResourceCustomFields instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.dropdown != null) {
    PaymentLinksResourceCustomFieldsDropdown.encode(
      instance.dropdown!,
      container.nestedSingleValueContainer('dropdown').encoder,
    );
  }
  container.encodeString(
    'key',
    instance.key,
  );
  PaymentLinksResourceCustomFieldsLabel.encode(
    instance.label,
    container.nestedSingleValueContainer('label').encoder,
  );
  if (instance.numeric != null) {
    PaymentLinksResourceCustomFieldsNumeric.encode(
      instance.numeric!,
      container.nestedSingleValueContainer('numeric').encoder,
    );
  }
  container.encodeBool(
    'optional',
    instance.optional,
  );
  if (instance.text != null) {
    PaymentLinksResourceCustomFieldsText.encode(
      instance.text!,
      container.nestedSingleValueContainer('text').encoder,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  return container.value;
}