encode<V> static method
Implementation
static V encode<V>(
ClimateProduct instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
container.encodeDateTime(
'created',
instance.created,
);
container.encodeMap(
'current_prices_per_metric_ton',
(container) => instance.currentPricesPerMetricTon.forEach((
key,
value,
) =>
ClimateRemovalsProductsPrice.encode(
value,
container.nestedSingleValueContainer(key).encoder,
)),
);
if (instance.deliveryYear != null) {
container.encodeInt(
'delivery_year',
instance.deliveryYear!,
);
}
container.encodeString(
'id',
instance.id,
);
container.encodeBool(
'livemode',
instance.livemode,
);
container.encodeString(
'metric_tons_available',
instance.metricTonsAvailable,
);
container.encodeString(
'name',
instance.name,
);
container.encodeString(
'object',
'climate.product',
);
container.encodeList(
'suppliers',
(container) => instance.suppliers.forEach((el) => ClimateSupplier.encode(
el,
container.nestedSingleValueContainer().encoder,
)),
);
return container.value;
}