toMap method

Map<String, dynamic> toMap({
  1. bool withId = true,
})

Implementation

Map<String, dynamic> toMap({bool withId = true}) {
  return <String, dynamic>{
    if (withId) 'Id': id,
    'Line': line.map((x) => x.toMap()).toList(),
    'CustomerRef': customerRef.toMap(),
    'SyncToken': syncToken,
    'CurrencyRef': currencyRef?.toMap(),
    'DocNumber': docNumber,
    'BillEmail': billEmail?.toMap(),
    'TxnDate':
        txnDate != null ? DateFormat('yyyy-MM-dd').format(txnDate!) : null,
    'ShipFromAddr': shipFromAddr?.toMap(),
    'ShipDate': shipDate?.toString(),
    'TrackingNum': trackingNum,
    'ClassRef': classRef?.toMap(),
    'PrintStatus': printStatus,
    'SalesTermRef': salesTermRef?.toMap(),
    'TxnSource': txnSource,
    'LinkedTxn': linkedTxn?.map((x) => x.toMap()).toList(),
    'DepositToAccountRef': depositToAccountRef?.toMap(),
    'GlobalTaxCalculation': globalTaxCalculation?.toJsonString(),
    'AllowOnlineACHPayment': allowOnlineACHPayment,
    'TransactionLocationType': transactionLocationType,
    'DueDate': dueDate?.toString(),
    'MetaData': metaData,
    'PrivateNote': privateNote,
    'BillEmailCc': billEmailCc?.toMap(),
    'CustomerMemo': customerMemo?.toMap(),
    'EmailStatus': emailStatus,
    'ExchangeRate': exchangeRate,
    'Deposit': deposit,
    'TxnTaxDetail': txnTaxDetail?.toMap(),
    'AllowOnlineCreditCardPayment': allowOnlineCreditCardPayment,
    'CustomField': customField,
    'ShipAddr': shipAddr?.toMap(),
    'DepartmentRef': departmentRef?.toMap(),
    'BillEmailBcc': billEmailBcc?.toMap(),
    'ShipMethodRef': shipMethodRef?.toMap(),
    'BillAddr': billAddr?.toMap(),
    'ApplyTaxAfterDiscount': applyTaxAfterDiscount,
    'HomeBalance': homeBalance,
    'DeliveryInfo': deliveryInfo?.toMap(),
    'TotalAmt': totalAmt,
    'InvoiceLink': invoiceLink,
    'RecurDataRef': recurDataRef?.toMap(),
    'TaxExemptionRef': taxExemptionRef?.toMap(),
    'Balance': balance,
    'HomeTotalAmt': homeTotalAmt,
    'FreeFormAddress': freeFormAddress,
  };
}