medicalloanfunction method

Future medicalloanfunction({
  1. dynamic name,
  2. dynamic mobile,
  3. dynamic email,
  4. dynamic gender,
  5. dynamic pancard,
  6. dynamic addharcard,
  7. dynamic credithistory,
  8. dynamic procedure,
  9. dynamic date,
  10. dynamic loanamt,
  11. dynamic city,
  12. dynamic hospitalname,
})

Implementation

Future medicalloanfunction({
  name,
  mobile,
  email,
  gender,
  pancard,
  addharcard,
  credithistory,
  procedure,
  date,
  loanamt,
  city,
  hospitalname,
}) async {
  final ApiBody = {
    "fullname": name,
    "mobile": mobile,
    "email": email,
    "gender": gender,
    "pancard_no": "${pancard}",
    "aadhar_number": "${addharcard}",
    "credit_history": "${credithistory}",
    "procedure": "${procedure}",
    "date_of_hospitalization": "${date}",
    "loan_amt": "${loanamt}",
    "city": "${city}",
    "hospital_name": "${hospitalname}",
  };
  var decodedResponse;

  try {
    final response = await http.post(
        Uri.parse(
            '${SDK_BASE_URL}claim_adminpanel/claim_api/medical_loan_request'),
        body: ApiBody,
        headers: {
          "Authorization": SignUpController.currentUserToken,
        });
    decodedResponse = json.decode(response.body);
    if (decodedResponse['status'] == true) {
      Get.off(HomePage(), transition: Transition.fadeIn);
      Get.snackbar(
        "Loan request generated successfully.",
        "${decodedResponse['message']}",
      );
    } else {
      Get.snackbar("Something Went Wrong", "${decodedResponse['message']}");
    }
  } catch (e) {
    errorListner(
        apiname: 'claim_adminpanel/claim_api/medical_loan_request',
        responsed: "${decodedResponse}",
        request: "${ApiBody}",
        app_error: '${e}');
  }
}