encode<V> static method

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

Implementation

static V encode<V>(
  SessionShipping instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  SessionShippingAddress.encode(
    instance.address,
    container.nestedSingleValueContainer('address').encoder,
  );
  if (instance.carrier != null) {
    container.encodeString(
      'carrier',
      instance.carrier!,
    );
  }
  container.encodeString(
    'name',
    instance.name,
  );
  if (instance.phone != null) {
    container.encodeString(
      'phone',
      instance.phone!,
    );
  }
  if (instance.trackingNumber != null) {
    container.encodeString(
      'tracking_number',
      instance.trackingNumber!,
    );
  }
  return container.value;
}