encode<V> static method

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

Implementation

static V encode<V>(
  IssuingTransactionPurchaseDetails instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.flight != null) {
    IssuingTransactionPurchaseDetailsFlight.encode(
      instance.flight!,
      container.nestedSingleValueContainer('flight').encoder,
    );
  }
  if (instance.fuel != null) {
    IssuingTransactionPurchaseDetailsFuel.encode(
      instance.fuel!,
      container.nestedSingleValueContainer('fuel').encoder,
    );
  }
  if (instance.lodging != null) {
    IssuingTransactionPurchaseDetailsLodging.encode(
      instance.lodging!,
      container.nestedSingleValueContainer('lodging').encoder,
    );
  }
  if (instance.receipt != null) {
    container.encodeList(
      'receipt',
      (container) => instance.receipt!
          .forEach((el) => IssuingTransactionReceiptData.encode(
                el,
                container.nestedSingleValueContainer().encoder,
              )),
    );
  }
  if (instance.reference != null) {
    container.encodeString(
      'reference',
      instance.reference!,
    );
  }
  return container.value;
}