encode<V> static method
V
encode<
V>( - TaxRate instance,
- Encoder<V> encoder
)
override
Implementation
static V encode<V>(
TaxRate instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
container.encodeBool(
'active',
instance.active,
);
if (instance.country != null) {
container.encodeString(
'country',
instance.country!,
);
}
container.encodeDateTime(
'created',
instance.created,
);
if (instance.description != null) {
container.encodeString(
'description',
instance.description!,
);
}
container.encodeString(
'display_name',
instance.displayName,
);
if (instance.effectivePercentage != null) {
container.encodeDouble(
'effective_percentage',
instance.effectivePercentage!,
);
}
container.encodeString(
'id',
instance.id,
);
container.encodeBool(
'inclusive',
instance.inclusive,
);
if (instance.jurisdiction != null) {
container.encodeString(
'jurisdiction',
instance.jurisdiction!,
);
}
if (instance.jurisdictionLevel != null) {
container.encodeString(
'jurisdiction_level',
instance.jurisdictionLevel!,
);
}
container.encodeBool(
'livemode',
instance.livemode,
);
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
container.encodeString(
'object',
'tax_rate',
);
container.encodeDouble(
'percentage',
instance.percentage,
);
if (instance.state != null) {
container.encodeString(
'state',
instance.state!,
);
}
if (instance.taxType != null) {
TaxProductResourceTaxRateDetailsTaxType.encode(
instance.taxType!,
container.nestedSingleValueContainer('tax_type').encoder,
);
}
return container.value;
}