encode<V> static method
Implementation
static V encode<V>(
ProductDefaultPriceData instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
container.encodeString(
'currency',
instance.currency,
);
if (instance.currencyOptions != null) {
container.encodeMap(
'currency_options',
(container) => instance.currencyOptions!.forEach((
key,
value,
) =>
PriceCurrencyOptionsValue.encode(
value,
container.nestedSingleValueContainer(key).encoder,
)),
);
}
if (instance.recurring != null) {
SessionRecurring.encode(
instance.recurring!,
container.nestedSingleValueContainer('recurring').encoder,
);
}
if (instance.taxBehavior != null) {
ShippingRateCurrencyOptionTaxBehavior.encode(
instance.taxBehavior!,
container.nestedSingleValueContainer('tax_behavior').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;
}