IntimateMyClaimFunction method

dynamic IntimateMyClaimFunction({
  1. dynamic patientname,
  2. dynamic reasonforclaim,
  3. dynamic nameofhospital,
  4. dynamic pinocde,
  5. dynamic city,
  6. dynamic state,
  7. dynamic remarks,
  8. dynamic selectedDate,
  9. dynamic fileupload,
  10. dynamic hospitaladdress,
})

Implementation

IntimateMyClaimFunction(
    {patientname,
    reasonforclaim,
    nameofhospital,
    pinocde,
    city,
    state,
    remarks,
    selectedDate,
    fileupload,
    hospitaladdress}) async {
  var request = http.MultipartRequest('POST',
      Uri.parse('${SDK_BASE_URL}claim_adminpanel/claim_api/intimate_claim'));
  request.headers
      .addAll({"Authorization": "${SignUpController.currentUserToken}"});
  request.fields['type'] = '3';
  request.fields['policy_no'] =
      policyList[indexvalue]['policy_no'].toString();
  request.fields['patientname'] = "${patientname}";
  request.fields['dateofhospitalization'] = '${selectedDate}';
  request.fields['hospitalname'] = nameofhospital;
  request.fields['causeofhospitalization'] = reasonforclaim;
  request.fields['type_claim'] = 'seft intimate';
  request.fields['hospitaladdress'] = hospitaladdress;
  request.fields['pincode'] = pinocde.toString();
  request.fields['city'] = city;
  request.fields['state'] = state;
  request.fields['remarks'] = remarks;

  request.files.add(
      await http.MultipartFile.fromPath("policy_files[]", "${fileupload}"));
  var response = await request.send();
  var responsed = await http.Response.fromStream(response);

  var decodedResponse = json.decode(responsed.body);
  if (decodedResponse['status'] == true) {
    Get.back();
    Get.to(HomePage());
    Fluttertoast.showToast(msg: '${decodedResponse['message']}');
  } else {
    Fluttertoast.showToast(msg: '${decodedResponse['message']}');
  }
}