encode<V> static method

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

Implementation

static V encode<V>(
  IssuingTransactionFlightData instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.departureAt != null) {
    container.encodeInt(
      'departure_at',
      instance.departureAt!,
    );
  }
  if (instance.passengerName != null) {
    container.encodeString(
      'passenger_name',
      instance.passengerName!,
    );
  }
  if (instance.refundable != null) {
    container.encodeBool(
      'refundable',
      instance.refundable!,
    );
  }
  if (instance.segments != null) {
    container.encodeList(
      'segments',
      (container) => instance.segments!
          .forEach((el) => IssuingTransactionFlightDataLeg.encode(
                el,
                container.nestedSingleValueContainer().encoder,
              )),
    );
  }
  if (instance.travelAgency != null) {
    container.encodeString(
      'travel_agency',
      instance.travelAgency!,
    );
  }
  return container.value;
}