GetcityFunction method

Future GetcityFunction(
  1. dynamic stateName
)

Implementation

Future GetcityFunction(stateName) async {
  var decodedResponse;
  final ApiBody = {"state": stateName};
  try {
    final response = await http.post(
        Uri.parse(
            '${SDK_BASE_URL}claim_adminpanel/claim_api/tpa_hospital/city'),
        body: ApiBody,
        headers: {"Authorization": SignUpController.currentUserToken});
    decodedResponse = json.decode(response.body);
    CityNamelist = decodedResponse['city'];

    if (decodedResponse['status'] == true) {
      Get.back();
    }
  } catch (e) {
    errorListner(
        apiname: 'claim_adminpanel/claim_api/tpa_hospital/city',
        responsed: "${decodedResponse}",
        request: '${ApiBody}',
        app_error: '${e}');
  }
}