encode<V> static method
Implementation
static V encode<V>(
CurrencyOption instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.customUnitAmount != null) {
CurrencyOptionCustomUnitAmount.encode(
instance.customUnitAmount!,
container.nestedSingleValueContainer('custom_unit_amount').encoder,
);
}
if (instance.taxBehavior != null) {
container.encodeString(
'tax_behavior',
instance.taxBehavior!,
);
}
if (instance.tiers != null) {
container.encodeList(
'tiers',
(container) => instance.tiers!.forEach((el) => PriceTier.encode(
el,
container.nestedSingleValueContainer().encoder,
)),
);
}
if (instance.unitAmount != null) {
container.encodeInt(
'unit_amount',
instance.unitAmount!,
);
}
if (instance.unitAmountDecimal != null) {
container.encodeString(
'unit_amount_decimal',
instance.unitAmountDecimal!,
);
}
return container.value;
}