toMap method

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

If withId is true, will send the id in the map

Implementation

Map<String, dynamic> toMap({bool withId = true}) {
  return {
    if (withId) 'Id': id,
    'FullyQualifiedName': fullyQualifiedName,
    'domain': domain,
    'Sku': sku,
    'Name': name,
    'UnitPrice': price,
    'PurchaseCost': cost,
    'Type': type.toJsonString(),
    'Description': description,
    'ParentRef': parentRef?.toMap(),
    'SyncToken': syncToken,
    'sparse': sparse,
    'Active': active,
    'Taxable': taxable,
    'IncomeAccountRef': incomeAccountRef?.toMap(),
    'PurchaseDesc': purchaseDesc,
    'ExpenseAccountRef': expenseAccountRef?.toMap(),
    'AssetAccountRef': expenseAccountRef?.toMap(),
    'TrackQtyOnHand': trackQtyOnHand,
    'QtyOnHand': qtyOnHand,
    'InvStartDate': invStartDate != null
        ? DateFormat('yyyy-MM-dd').format(invStartDate!)
        : null,
    'MetaData': metaData,
  };
}