QuickbooksInvoice.fromMap constructor

QuickbooksInvoice.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory QuickbooksInvoice.fromMap(Map<String, dynamic> map) {
  return QuickbooksInvoice(
    id: map['Id'],
    line: List<QuickbooksLine>.from(
      (map['Line'] as List).map<QuickbooksLine>(
        (x) => QuickbooksLine.fromMap(x as Map<String, dynamic>),
      ),
    ),
    customerRef: QuickbooksReferenceType.fromMap(
        map['CustomerRef'] as Map<String, dynamic>),
    syncToken: map['SyncToken'],
    currencyRef: map['CurrencyRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['CurrencyRef'] as Map<String, dynamic>)
        : null,
    docNumber: map['DocNumber'],
    billEmail: map['BillEmail'] != null
        ? QuickbooksEmailAddress.fromMap(
            map['BillEmail'] as Map<String, dynamic>)
        : null,
    txnDate: DateTime.tryParse(map['TxnDate'].toString()),
    shipFromAddr: map['ShipFromAddr'] != null
        ? QuickbooksPhysicalAddress.fromMap(
            map['ShipFromAddr'] as Map<String, dynamic>)
        : null,
    shipDate: DateTime.tryParse(map['ShipDate'].toString()),
    trackingNum: map['TrackingNum'],
    classRef: map['ClassRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['ClassRef'] as Map<String, dynamic>)
        : null,
    printStatus: map['PrintStatus'],
    salesTermRef: map['SalesTermRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['SalesTermRef'] as Map<String, dynamic>)
        : null,
    txnSource: map['TxnSource'],
    linkedTxn: map['LinkedTxn'] != null
        ? List<QuickbooksLinkedTxn>.from(
            (map['LinkedTxn'] as List).map<QuickbooksLinkedTxn?>(
              (x) => QuickbooksLinkedTxn.fromMap(x as Map<String, dynamic>),
            ),
          )
        : null,
    depositToAccountRef: map['DepositToAccountRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['DepositToAccountRef'] as Map<String, dynamic>)
        : null,
    globalTaxCalculation: map['BlobalTaxCalculation'] != null
        ? QuickbooksGlobalTaxCalculationTypeExtension.fromJsonString(
            map['GlobalTaxCalculation'])
        : null,
    allowOnlineACHPayment: map['AllowOnlineACHPayment'],
    transactionLocationType: map['TransactionLocationType'],
    dueDate: DateTime.tryParse(map['DueDate'].toString()),
    metaData: map['MetaData'],
    privateNote: map['PrivateNote'],
    billEmailCc: map['BillEmailCc'] != null
        ? QuickbooksEmailAddress.fromMap(
            map['BillEmailCc'] as Map<String, dynamic>)
        : null,
    customerMemo: map['CustomerMemo'] != null
        ? QuickbooksMemoRef.fromMap(
            map['CustomerMemo'] as Map<String, dynamic>)
        : null,
    emailStatus: map['EmailStatus'],
    exchangeRate: double.tryParse(map['ExchangeRate'].toString()),
    deposit: double.tryParse(map['Deposit'].toString()),
    txnTaxDetail: map['TxnTaxDetail'] != null
        ? QuickbooksTxnTaxDetails.fromMap(
            map['TxnTaxDetail'] as Map<String, dynamic>)
        : null,
    allowOnlineCreditCardPayment: map['AllowOnlineCreditCardPayment'],
    customField: map['CustomField'] != null
        ? List<Map<String, dynamic>>.from(
            (map['CustomField'] as List).map<Map<String, dynamic>?>(
              (x) => x as Map<String, dynamic>,
            ),
          )
        : null,
    shipAddr: map['ShipAddr'] != null
        ? QuickbooksPhysicalAddress.fromMap(
            map['ShipAddr'] as Map<String, dynamic>)
        : null,
    departmentRef: map['DepartmentRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['DepartmentRef'] as Map<String, dynamic>)
        : null,
    billEmailBcc: map['BillEmailBcc'] != null
        ? QuickbooksEmailAddress.fromMap(
            map['BillEmailBcc'] as Map<String, dynamic>)
        : null,
    shipMethodRef: map['ShipMethodRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['ShipMethodRef'] as Map<String, dynamic>)
        : null,
    billAddr: map['BillAddr'] != null
        ? QuickbooksPhysicalAddress.fromMap(
            map['BillAddr'] as Map<String, dynamic>)
        : null,
    applyTaxAfterDiscount: map['ApplyTaxAfterDiscount'],
    homeBalance: double.tryParse(map['homeBalance'].toString()),
    deliveryInfo: map['DeliveryInfo'] != null
        ? QuickbooksDeliveryInfo.fromMap(
            map['DeliveryInfo'] as Map<String, dynamic>)
        : null,
    totalAmt: double.tryParse(map['TotalAmt'].toString()),
    invoiceLink: map['InvoiceLink'],
    recurDataRef: map['RecurDataRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['RecurDataRef'] as Map<String, dynamic>)
        : null,
    taxExemptionRef: map['TaxExemptionRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['TaxExemptionRef'] as Map<String, dynamic>)
        : null,
    balance: double.tryParse(map['Balance'].toString()),
    homeTotalAmt: double.tryParse(map['HomeTotalAmt'].toString()),
    freeFormAddress: map['FreeFormAddress'],
  );
}