encode<V> static method

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

Implementation

static V encode<V>(
  ClimateRemovalsOrderDeliveries instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeDateTime(
    'delivered_at',
    instance.deliveredAt,
  );
  if (instance.location != null) {
    ClimateRemovalsLocation.encode(
      instance.location!,
      container.nestedSingleValueContainer('location').encoder,
    );
  }
  container.encodeString(
    'metric_tons',
    instance.metricTons,
  );
  if (instance.registryUrl != null) {
    container.encodeString(
      'registry_url',
      instance.registryUrl!,
    );
  }
  ClimateSupplier.encode(
    instance.supplier,
    container.nestedSingleValueContainer('supplier').encoder,
  );
  return container.value;
}