encode<V> static method

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

Implementation

static V encode<V>(
  PlanProductInlineProductParams instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.active != null) {
    container.encodeBool(
      'active',
      instance.active!,
    );
  }
  if (instance.id != null) {
    container.encodeString(
      'id',
      instance.id!,
    );
  }
  if (instance.metadata != null) {
    container.encodeMap(
      'metadata',
      (container) => instance.metadata!.forEach((
        key,
        value,
      ) =>
          container.encodeString(
            key,
            value,
          )),
    );
  }
  container.encodeString(
    'name',
    instance.name,
  );
  if (instance.statementDescriptor != null) {
    container.encodeString(
      'statement_descriptor',
      instance.statementDescriptor!,
    );
  }
  if (instance.taxCode != null) {
    container.encodeString(
      'tax_code',
      instance.taxCode!,
    );
  }
  if (instance.unitLabel != null) {
    container.encodeString(
      'unit_label',
      instance.unitLabel!,
    );
  }
  return container.value;
}