QuickbooksProduct.fromMap constructor

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

Implementation

factory QuickbooksProduct.fromMap(Map<String, dynamic> map) {
  return QuickbooksProduct(
    id: map['Id'],
    fullyQualifiedName: map['FullyQualifiedName'],
    domain: map['domain'],
    sku: map['Sku'],
    name: map['Name'],
    price: double.tryParse(map['UnitPrice'].toString()),
    cost: double.tryParse(map['PurchaseCost'].toString()),
    type: QuickbooksProductTypeExtension.fromJsonString(map['Type']),
    description: map['Description'],
    parentRef: (map['ParentRef'] != null)
        ? QuickbooksReferenceType.fromMap(map['ParentRef'])
        : null,
    syncToken: map['SyncToken'],
    sparse: map['sparse'],
    active: map['Active'],
    taxable: map['Taxable'],
    incomeAccountRef: (map['IncomeAccountRef'] != null)
        ? QuickbooksReferenceType.fromMap(map['IncomeAccountRef'])
        : null,
    purchaseDesc: map['PurchaseDesc'],
    expenseAccountRef: (map['ExpenseAccountRef'] != null)
        ? QuickbooksReferenceType.fromMap(map['ExpenseAccountRef'])
        : null,
    assetAccountRef: (map['AssetAccountRef'] != null)
        ? QuickbooksReferenceType.fromMap(map['AssetAccountRef'])
        : null,
    trackQtyOnHand: map['TrackQtyOnHand'],
    qtyOnHand: int.tryParse(map['QtyOnHand'].toString()),
    invStartDate: DateTime.tryParse(map['InvStartDate'].toString()),
    metaData: map['MetaData'],
  );
}