KycDocSubmission method
Future
KycDocSubmission(
{ - dynamic context,
})
Implementation
Future KycDocSubmission({context}) async {
var request = http.MultipartRequest(
'POST', Uri.parse('${choice_Base_Url}kyc_add_documents'));
request.headers.addAll({"Authorization": "${choiceToken}"});
for (int i = 0; i < kycAddArray.length; i++) {
request.files.add(await http.MultipartFile.fromPath(
"kyc_upload_file[${i}]", "${kycAddArray[i]['docImage']}"));
request.fields['document_type[${i}]'] = '${kycAddArray[i]['docType']}';
}
request.fields['intimation_id'] = '${ClaimSubmissionNumber}';
var response = await request.send();
var responsed = await http.Response.fromStream(response);
var decodedResponse = json.decode(responsed.body);
if (decodedResponse['status'] == true) {
Get.back();
kycAddArray = [];
Get.to(
ChoiceThirdPageClaimSubmission(),
);
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return ChoiceAlertPopup(
messag: "${decodedResponse['message'] ?? errorMessage}",
image:
'${BASE_URL}assets/images/medibhai_images/lottie/Upload_Successful.json',
);
},
);
} else {
Get.back();
kycAddArray = [];
Fluttertoast.showToast(
msg: '${decodedResponse['message'] ?? errorMessage}');
}
}