toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final map = <String, dynamic>{};
  if (data != null) {
    map['data'] = data?.map((v) => v.toJson()).toList();
  }
  map['total_item'] = totalItem;
  map['sub_total'] = subTotal;
  map['discount'] = discount;
  map['discount_display'] = discountDisplay;
  map['discount_price'] = discountPrice;
  map['sgst'] = sgst;
  map['cgst'] = cgst;
  map['igst'] = igst;
  map['rounding_off'] = roundingOff;
  map['grand_total'] = grandTotal;
  map['total_records'] = totalRecords;
  if (summary != null) {
    map['summary'] = summary?.map((v) => v.toJson()).toList();
  }
  if (freeProduct != null) {
    map['free_product'] = freeProduct?.map((v) => v.toJson()).toList();
  }
  if (freeProductTotal != null) {
    map['free_product_total'] = freeProductTotal?.toJson();
  }
  if (userWiseChanges != null) {
    map['user_wise_changes'] = userWiseChanges?.toJson();
  }

  if (requirePrescription != null) {
    map['require_prescription'] = requirePrescription?.toJson();
  }
  map['success'] = success;
  map['message'] = message;
  return map;
}