UploadDocument method
Future
UploadDocument(
{ - dynamic img,
})
Implementation
Future UploadDocument({img}) async {
var request = http.MultipartRequest('POST',
Uri.parse('${SDK_BASE_URL}claim_adminpanel/claim_api/document_upload'));
request.headers
.addAll({"Authorization": "${SignUpController.currentUserToken}"});
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();
Fluttertoast.showToast(msg: '${decodedResponse['message']}');
} else {
Fluttertoast.showToast(msg: '${decodedResponse['message']}');
}
}