QuickbooksPurchase.fromMap constructor

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

Implementation

factory QuickbooksPurchase.fromMap(Map<String, dynamic> map) {
  return QuickbooksPurchase(
    id: map['Id'],
    line: map['Line'] != null
        ? List<QuickbooksLine>.from(
            (map['Line'] as List).map<QuickbooksLine?>(
              (x) => QuickbooksLine.fromMap(x as Map<String, dynamic>),
            ),
          )
        : null,
    paymentType: map['PaymentType'],
    accountRef: map['AccountRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['AccountRef'] as Map<String, dynamic>)
        : null,
    syncToken: map['SyncToken'],
    currencyRef: map['CurrencyRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['CurrencyRef'] as Map<String, dynamic>)
        : null,
    txnDate: DateTime.tryParse(map['TxnDate'].toString()),
    printStatus: map['PrintStatus'],
    remitToAddr: map['RemitToAddr'] != null
        ? QuickbooksPhysicalAddress.fromMap(
            map['RemitToAddr'] 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,
    globalTaxCalculation: map['GlobalTaxCalculation'],
    transactionLocationType: map['TransactionLocationType'],
    metaData: map['MetaData'],
    docNumber: map['DocNumber'],
    privateNote: map['PrivateNote'],
    credit: map['Credit'],
    txnTaxDetail: map['TxnTaxDetail'] != null
        ? QuickbooksTxnTaxDetails.fromMap(
            map['TxnTaxDetail'] as Map<String, dynamic>)
        : null,
    paymentMethodRef: map['PaymentMethodRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['PaymentMethodRef'] as Map<String, dynamic>)
        : null,
    exchangeRate: double.tryParse(map['ExchangeRate'].toString()),
    departmentRef: map['DepartmentRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['DepartmentRef'] as Map<String, dynamic>)
        : null,
    entityRef: map['EntityRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['EntityRef'] as Map<String, dynamic>)
        : null,
    includeInAnnualTPAR: map['IncludeInAnnualTPAR'],
    totalAmt: double.tryParse(map['TotalAmt'].toString()),
    recurDataRef: map['RecurDataRef'] != null
        ? QuickbooksReferenceType.fromMap(
            map['RecurDataRef'] as Map<String, dynamic>)
        : null,
  );
}