SearchHospitalList method

Future SearchHospitalList({
  1. dynamic hospitalName,
  2. dynamic stateName,
  3. dynamic city,
})

Implementation

Future SearchHospitalList({hospitalName, stateName, city}) async {
  var decodedResponse;
  final ApiBody = {
    "state": stateName.toString(),
    "city": city.toString(),
    "tpa_id":
        getPolicyDetails['policies_listing'][indexvalue]['tpa_id'].toString(),
    "txt_hospital_name": hospitalName,
    "insurer_id": getPolicyDetails['policies_listing'][indexvalue]
            ['insurer_id']
        .toString(),
  };
  try {
    final response = await http.post(
        Uri.parse('${SDK_BASE_URL}claim_adminpanel/claim_api/tpa_hospital'),
        body: ApiBody,
        headers: {"Authorization": SignUpController.currentUserToken});
    decodedResponse = json.decode(response.body);

    if (decodedResponse['status'] == true) {
      HospitalList = decodedResponse['hospital'];
      Get.to(SearchHospital(), transition: transitioneffect);
    }
  } catch (e) {
    errorListner(
        apiname: 'claim_adminpanel/claim_api/tpa_hospital',
        responsed: "${decodedResponse}",
        request: '${ApiBody}',
        app_error: '${e}');
  }
}