UploadTrackClaim method

Future UploadTrackClaim({
  1. dynamic img,
  2. dynamic intimateno,
})

Implementation

Future UploadTrackClaim({
  img,
  intimateno,
}) async {
  var request = http.MultipartRequest(
      'POST',
      Uri.parse(
          '${SDK_BASE_URL}claim_adminpanel/claim_api/file_intimation_no_upload'));
  request.headers
      .addAll({"Authorization": "${SignUpController.currentUserToken}"});
  request.fields['policy_no'] =
      "${policyList[indexvalue]['policy_no'].toString()}";
  request.files
      .add(await http.MultipartFile.fromPath("policy_files[]", "${img}"));
  var response = await request.send();
  var responsed = await http.Response.fromStream(response);

  var decodedResponse = json.decode(responsed.body);

  if (decodedResponse['status'] == 200) {
    Get.back();
    Get.offAll(HomePage());
    Fluttertoast.showToast(msg: '${decodedResponse['message']}');
  } else {
    Fluttertoast.showToast(msg: '${decodedResponse['message']}');
  }
}