toJson method

  1. @override
Map<String, dynamic> toJson()
override

Converts the BaseDTO to a JSON object.

This method can be used when making HTTP requests to convert the DTO to a format that can be sent in the request.

Implementation

@override
Map<String, dynamic> toJson() {
  final Map<String, dynamic> data = super.toJson();
  data['stockType'] = stockType;
  data['type'] = type;
  data['status'] = status;
  data['include'] = include;
  data['note'] = note;
  data['sku'] = sku;
  data['quantity'] = quantity;
  data['startDate'] = startDate;
  data['endDate'] = endDate;
  data['purchaseDate'] = purchaseDate;
  data['purchasePrice'] = purchasePrice;
  data['purchaseCurrency'] = purchaseCurrency;
  data['transactionDate'] = transactionDate;
  data['storeId'] = storeId;
  data['productId'] = productId;
  data['warehouseId'] = warehouseId;
  data['transferId'] = transferId;
  data['supplierId'] = supplierId;
  data['inStockId'] = inStockId;
  data['productName'] = productName;
  data['productBarcode'] = productBarcode;
  data['productSlug'] = productSlug;
  data['warehouseName'] = warehouseName;
  data['supplierName'] = supplierName;
  if (product != null) {
    data['product'] = product!.toJson();
  }
  if (supplier != null) {
    data['supplier'] = supplier!.toJson();
  }
  if (warehouse != null) {
    data['warehouse'] = warehouse!.toJson();
  }
  return data;
}