getTeleconsultationSpecialistList method

dynamic getTeleconsultationSpecialistList()

Implementation

getTeleconsultationSpecialistList() async {
  var decodedResponse;
  try {
    var url = '${medicine_API}api/teleconsultation/departments';

    if (packageId.isNotEmpty) {
      url += '?package_id=$packageId';
    }

    http.Response response = await http.get(
      Uri.parse(url),
      headers: {
        "Authorization": currentUserToken,
      },
    );

    decodedResponse = json.decode(response.body);

    departments = decodedResponse['data']['department'];

    teleconsultationfreeList = departments
        .where((service) => service['is_nutrition'] == true)
        .toList();

    teleconsultationSpeciaList = departments
        .where((service) => service['is_nutrition'] == false)
        .toList();
  } catch (e) {
    ErrorListner(
      apiname: 'api/teleconsultation/departments?package_id=1',
      responsed: "${decodedResponse}",
      request: '',
      app_error: '${e}',
    );
  }
}