FindDoctor method

Future FindDoctor({
  1. dynamic doctorname,
  2. dynamic departmentName,
  3. dynamic location,
  4. dynamic pincode,
  5. dynamic mobilenumber,
})

Implementation

Future FindDoctor(
    {doctorname, departmentName, location, pincode, mobilenumber}) async {
  final ApiBody = {
    "name": doctorname,
    "department_name": departmentName,
    "location": location,
    "pincode": pincode.toString(),
    "type": "doctor",
    "mobile_no": mobilenumber.toString(),
  };
  var decodedResponse;
  try {
    final response = await http.post(
        Uri.parse('${SDK_BASE_URL}api/home_index/couldnt_find'),
        body: ApiBody,
        headers: {
          "Authorization": SignUpController.currentUserToken,
        });
    decodedResponse = json.decode(response.body);

    if (response.statusCode == 200) {
      Get.back();

      Get.snackbar(
        "Your Appointment Request Successfully Sent.",
        " Our executive team will contact you within 30 minutes for further coordination",
      );
    }
  } catch (e) {
    ErrorListner(
        apiname: 'api/doctors/couldnt_find',
        responsed: "${decodedResponse}",
        request: '${ApiBody}',
        app_error: '${e}');
  }
}