From 334150894a46cd528a26c233ae07f819da6c8557 Mon Sep 17 00:00:00 2001 From: Mohammad ALjammal Date: Tue, 9 Jun 2020 17:31:07 +0300 Subject: [PATCH 1/2] Change http call to BaseAppClient --- lib/client/base_app_client.dart | 5 +- lib/providers/hospital_provider.dart | 7 - lib/providers/medicine_provider.dart | 75 ++----- lib/providers/patients_provider.dart | 305 ++++++++------------------- 4 files changed, 109 insertions(+), 283 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 39b3c683..124e361e 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -20,6 +20,7 @@ Helpers helpers = new Helpers(); *@return: *@desc: */ + ///Example /* await BaseAppClient.post('', @@ -28,7 +29,6 @@ Helpers helpers = new Helpers(); body: null); * */ class BaseAppClient { - static post( String endPoint, { Map body, @@ -44,7 +44,8 @@ class BaseAppClient { body['DoctorID'] = doctorProfile?.doctorID; body['EditedBy'] = doctorProfile?.doctorID; body['ProjectID'] = doctorProfile?.projectID; - body['ClinicID'] = doctorProfile?.clinicID; + if (!body.containsKey('ClinicID')) + body['ClinicID'] = doctorProfile?.clinicID; } body['TokenID'] = token ?? ''; body['LanguageID'] = LANGUAGE_ID; diff --git a/lib/providers/hospital_provider.dart b/lib/providers/hospital_provider.dart index 834b3889..8c22ae0b 100644 --- a/lib/providers/hospital_provider.dart +++ b/lib/providers/hospital_provider.dart @@ -18,13 +18,6 @@ class HospitalProvider with ChangeNotifier { "SessionID": "i1UJwCTSqt", "IsLoginForDoctorApp": true }; - // try { - // final response = await AppClient.post(url, body: json.encode(info)); - // return Future.value(json.decode(response.body)); - // } catch (error) { - // throw error; - // // print('error'); - // } await BaseAppClient.post(url, onSuccess: ( response, statusCode) { diff --git a/lib/providers/medicine_provider.dart b/lib/providers/medicine_provider.dart index a0d8f4ed..0f8734f4 100644 --- a/lib/providers/medicine_provider.dart +++ b/lib/providers/medicine_provider.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:doctor_app_flutter/client/app_client.dart'; +import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/models/pharmacies_List_request_model.dart'; @@ -11,47 +12,32 @@ import 'package:flutter/cupertino.dart'; class MedicineProvider with ChangeNotifier { DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); - + var pharmacyItemsList = []; var pharmaciesList = []; bool isFinished = true; bool hasError = false; String errorMsg = ''; - PharmaciesItemsRequestModel _itemsRequestModel =PharmaciesItemsRequestModel(); + PharmaciesItemsRequestModel _itemsRequestModel = + PharmaciesItemsRequestModel(); PharmaciesListRequestModel _listRequestModel = PharmaciesListRequestModel(); Future getMedicineItem(String itemName) async { resetDefaultValues(); try { - if (await Helpers.checkConnection()) { - _itemsRequestModel.pHRItemName = itemName; - - final response = await AppClient.post(PHARMACY_ITEMS_URL, - body: json.encode(_itemsRequestModel.toJson())); - final int statusCode = response.statusCode; + _itemsRequestModel.pHRItemName = itemName; + await BaseAppClient.post(PHARMACY_ITEMS_URL, + onSuccess: (dynamic response, int statusCode) { + pharmacyItemsList = response['ListPharmcy_Region']; + hasError = false; isFinished = true; - if (statusCode < 200 || statusCode >= 400 || json == null) { - isFinished = true; - hasError = true; - errorMsg = 'Error While Fetching data'; - } else { - var parsed = json.decode(response.body.toString()); - if (parsed['MessageStatus'] == 1) { - pharmacyItemsList = parsed['ListPharmcy_Region']; - hasError = false; - isFinished = true; - errorMsg = "Done"; - } else { - hasError = true; - errorMsg = parsed['ErrorMessage'] ?? parsed['ErrorEndUserMessage']; - } - } - } else { + errorMsg = "Done"; + }, onFailure: (String error, int statusCode) { isFinished = true; hasError = true; - errorMsg = 'Please Check The Internet Connection'; - } + errorMsg = error; + }, body: _itemsRequestModel.toJson()); notifyListeners(); } catch (error) { throw error; @@ -61,37 +47,20 @@ class MedicineProvider with ChangeNotifier { } Future getPharmaciesList(int itemId) async { - String token = await sharedPref.getString(TOKEN); resetDefaultValues(); try { - if (await Helpers.checkConnection()) { - _listRequestModel.itemID = itemId; - _listRequestModel.tokenID = token; - final response = await AppClient.post(PHARMACY_LIST_URL, - body: json.encode(_listRequestModel.toJson())); - final int statusCode = response.statusCode; + _listRequestModel.itemID = itemId; + await BaseAppClient.post(PHARMACY_LIST_URL, + onSuccess: (dynamic response, int statusCode) { + pharmaciesList = response['PharmList']; + hasError = false; isFinished = true; - if (statusCode < 200 || statusCode >= 400 || json == null) { - isFinished = true; - hasError = true; - errorMsg = 'Error While Fetching data'; - } else { - var parsed = json.decode(response.body.toString()); - if (parsed['MessageStatus'] == 1) { - pharmaciesList = parsed['PharmList']; - hasError = false; - isFinished = true; - errorMsg = "Done"; - } else { - hasError = true; - errorMsg = parsed['ErrorMessage'] ?? parsed['ErrorEndUserMessage']; - } - } - } else { + errorMsg = "Done"; + }, onFailure: (String error, int statusCode) { isFinished = true; hasError = true; - errorMsg = 'Please Check The Internet Connection'; - } + errorMsg = error; + }, body: _listRequestModel.toJson()); notifyListeners(); } catch (error) { throw error; diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index e2e6c061..ca88a5b7 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -71,11 +71,8 @@ class PatientsProvider with ChangeNotifier { Future getPatientList(PatientModel patient, patientType) async { int val = int.parse(patientType); - final url = - BASE_URL + "DoctorApplication.svc/REST/" + SERVICES_PATIANT[val]; - try { - await BaseAppClient.post(url, + await BaseAppClient.post( SERVICES_PATIANT[val], onSuccess: (dynamic response, int statusCode) { return Future.value(response); }, onFailure: (String error, int statusCode) { @@ -125,21 +122,10 @@ class PatientsProvider with ChangeNotifier { setBasicData(); try { - if (await Helpers.checkConnection()) { - final response = await AppClient.post(GET_PATIENT_VITAL_SIGN, - body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { + await BaseAppClient.post(GET_PATIENT_VITAL_SIGN, + onSuccess: (dynamic response, int statusCode) { patientVitalSignList = []; - res['List_DoctorPatientVitalSign'].forEach((v) { + response['List_DoctorPatientVitalSign'].forEach((v) { patientVitalSignList.add(new VitalSignResModel.fromJson(v)); }); @@ -157,16 +143,13 @@ class PatientsProvider with ChangeNotifier { .add(patientVitalSignOrderdSubListTemp[x]); } } - } else { + }, + onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, + body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -185,33 +168,19 @@ class PatientsProvider with ChangeNotifier { setBasicData(); try { - if (await Helpers.checkConnection()) { - final response = await AppClient.post(GET_PATIENT_LAB_OREDERS, - body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { + await BaseAppClient.post(GET_PATIENT_LAB_OREDERS, + onSuccess: (dynamic response, int statusCode) { patientLabResultOrdersList = []; - res['List_GetLabOreders'].forEach((v) { + response['List_GetLabOreders'].forEach((v) { patientLabResultOrdersList.add(new LabOrdersResModel.fromJson(v)); }); - } else { + }, + onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, + body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -226,36 +195,21 @@ class PatientsProvider with ChangeNotifier { */ getOutPatientPrescriptions(patient) async { setBasicData(); - try { - if (await Helpers.checkConnection()) { - final response = - await AppClient.post(GET_PRESCRIPTION, body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { + await BaseAppClient.post(GET_PRESCRIPTION, + onSuccess: (dynamic response, int statusCode) { patientPrescriptionsList = []; - res['PatientPrescriptionList'].forEach((v) { + response['PatientPrescriptionList'].forEach((v) { patientPrescriptionsList .add(new PrescriptionResModel.fromJson(v)); }); - } else { + }, + onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, + body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -339,33 +293,20 @@ class PatientsProvider with ChangeNotifier { // notifyListeners(); setBasicData(); try { - if (await Helpers.checkConnection()) { - final response = - await AppClient.post(GET_RADIOLOGY, body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { + await BaseAppClient.post(GET_RADIOLOGY, + onSuccess: (dynamic response, int statusCode) { patientRadiologyList = []; - res['List_GetRadOreders'].forEach((v) { + response['List_GetRadOreders'].forEach((v) { patientRadiologyList.add(new RadiologyResModel.fromJson(v)); }); - } else { + }, + onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, + body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -399,31 +340,16 @@ class PatientsProvider with ChangeNotifier { getPatientInsuranceApprovals(patient) async { setBasicData(); try { - if (await Helpers.checkConnection()) { - final response = await AppClient.post(PATIENT_INSURANCE_APPROVALS_URL, - body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { - //patientRadiologyList = []; - insuranceApporvalsList = res['List_ApprovalMain_InPatient']; - } else { + await BaseAppClient.post(PATIENT_INSURANCE_APPROVALS_URL, + onSuccess: (dynamic response, int statusCode) { + insuranceApporvalsList = response['List_ApprovalMain_InPatient']; + }, + onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, + body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -437,30 +363,17 @@ class PatientsProvider with ChangeNotifier { getPatientProgressNote(patient) async { setBasicData(); try { - if (await Helpers.checkConnection()) { - final response = await AppClient.post(PATIENT_PROGRESS_NOTE_URL, - body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { - patientProgressNoteList = res['List_GetPregressNoteForInPatient']; - } else { + await BaseAppClient.post(PATIENT_PROGRESS_NOTE_URL, + onSuccess: (dynamic response, int statusCode) { + patientProgressNoteList = response['List_GetPregressNoteForInPatient']; + }, + onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, + body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -472,38 +385,19 @@ class PatientsProvider with ChangeNotifier { *@desc: getDoctorsList */ getDoctorsList(String clinicId) async { - String token = await sharedPref.getString(TOKEN); - int projectID = await sharedPref.getInt(PROJECT_ID); setBasicData(); try { - if (await Helpers.checkConnection()) { - _doctorsByClinicIdRequest.projectID = projectID; - _doctorsByClinicIdRequest.clinicID = clinicId; - _doctorsByClinicIdRequest.tokenID = token; - - final response = await AppClient.post(PATIENT_GET_DOCTOR_BY_CLINIC_URL, - body: json.encode(_doctorsByClinicIdRequest)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { - doctorsList = res['List_Doctors_All']; - } else { + _doctorsByClinicIdRequest.clinicID = clinicId; + await BaseAppClient.post(PATIENT_GET_DOCTOR_BY_CLINIC_URL, + onSuccess: (dynamic response, int statusCode) { + doctorsList = response['List_Doctors_All']; + }, + onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, + body: _doctorsByClinicIdRequest.toJson()); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -521,37 +415,19 @@ class PatientsProvider with ChangeNotifier { *@desc: getClinicsList */ getClinicsList() async { - String token = await sharedPref.getString(TOKEN); setBasicData(); try { - if (await Helpers.checkConnection()) { - int projectID = await sharedPref.getInt(PROJECT_ID); - _clinicByProjectIdRequest.projectID = projectID; - _clinicByProjectIdRequest.tokenID = token; - final response = await AppClient.post(PATIENT_GET_CLINIC_BY_PROJECT_URL, - body: json.encode(_clinicByProjectIdRequest)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { - clinicsList = res['List_Clinic_All']; - } else { + await BaseAppClient.post(PATIENT_GET_CLINIC_BY_PROJECT_URL, + onSuccess: (dynamic response, int statusCode) { + clinicsList = response['List_Clinic_All']; + }, + onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, + body: _clinicByProjectIdRequest.toJson()); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -573,30 +449,17 @@ class PatientsProvider with ChangeNotifier { String token = await sharedPref.getString(TOKEN); setBasicData(); try { - if (await Helpers.checkConnection()) { - _referralFrequencyRequest.tokenID = token; - final response = await AppClient.post(PATIENT_GET_LIST_REFERAL_URL, - body: json.encode(_referralFrequencyRequest)); - final int statusCode = response.statusCode; - isLoading = false; - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { - referalFrequancyList = res['list_STPReferralFrequency']; - } else { + + await BaseAppClient.post(PATIENT_GET_LIST_REFERAL_URL, + onSuccess: (dynamic response, int statusCode) { + referalFrequancyList = response['list_STPReferralFrequency']; + }, + onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, + body: _referralFrequencyRequest.toJson()); notifyListeners(); } catch (err) { handelCatchErrorCase(err); From eb09cda2a187573e9d473c33ccf2b9b23f7249a3 Mon Sep 17 00:00:00 2001 From: Mohammad ALjammal Date: Wed, 10 Jun 2020 11:04:53 +0300 Subject: [PATCH 2/2] fix issues in patients provider --- lib/client/base_app_client.dart | 2 +- lib/config/config.dart | 4 +-- lib/providers/patients_provider.dart | 45 +++++++++++++++++++++++----- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 124e361e..031c70ac 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -57,7 +57,7 @@ class BaseAppClient { body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['PatientOutSA'] = PATIENT_OUT_SA; - if (await Helpers.checkConnection()) { + if (await Helpers.checkConnection()) { final response = await http.post(url, body: json.encode(body), headers: { diff --git a/lib/config/config.dart b/lib/config/config.dart index 6e75ccf2..e80acab5 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -2,8 +2,8 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z]"; const ONLY_DATE = "[0-9/]"; -// const BASE_URL = 'https://hmgwebservices.com/Services/'; -const BASE_URL = 'https://uat.hmgwebservices.com/Services/'; + const BASE_URL = 'https://hmgwebservices.com/Services/'; +//const BASE_URL = 'https://uat.hmgwebservices.com/Services/'; const PHARMACY_ITEMS_URL = "Lists.svc/REST/GetPharmcyItems_Region"; const PHARMACY_LIST_URL = "Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "DoctorApplication.svc/REST/GetProgressNoteForInPatient"; diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index ca88a5b7..0770ad47 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -68,14 +68,15 @@ class PatientsProvider with ChangeNotifier { PatiantInformtion _selectedPatient; - Future getPatientList(PatientModel patient, patientType) async { + getPatientList(PatientModel patient, patientType) async { int val = int.parse(patientType); try { - await BaseAppClient.post( SERVICES_PATIANT[val], - onSuccess: (dynamic response, int statusCode) { - return Future.value(response); - }, onFailure: (String error, int statusCode) { + var localResponse ; + await BaseAppClient.post( 'DoctorApplication.svc/REST/'+SERVICES_PATIANT[val], + onSuccess: (dynamic response, int statusCode) async{ + localResponse = response; + }, onFailure: (String error, int statusCode) async{ throw error; }, body: { "ProjectID": patient.ProjectID, @@ -99,9 +100,12 @@ class PatientsProvider with ChangeNotifier { "IsLoginForDoctorApp": patient.IsLoginForDoctorApp, "PatientOutSA": patient.PatientOutSA }); + + return localResponse; } catch (err) { handelCatchErrorCase(error); } + } setBasicData() { @@ -138,11 +142,15 @@ class PatientsProvider with ChangeNotifier { a.vitalSignDate.microsecondsSinceEpoch; }); patientVitalSignOrderdSubList.clear(); - for (int x = 0; x < 20; x++) { + int length = patientVitalSignOrderdSubListTemp.length >= 20 ? 20 : patientVitalSignOrderdSubListTemp.length; + for (int x = 0; x < length; x++) { patientVitalSignOrderdSubList .add(patientVitalSignOrderdSubListTemp[x]); } } + isLoading = false; + isError = false; + this.error = ''; }, onFailure: (String error, int statusCode) { isLoading = false; @@ -174,6 +182,9 @@ class PatientsProvider with ChangeNotifier { response['List_GetLabOreders'].forEach((v) { patientLabResultOrdersList.add(new LabOrdersResModel.fromJson(v)); }); + isLoading = false; + isError = false; + this.error = ''; }, onFailure: (String error, int statusCode) { isLoading = false; @@ -203,6 +214,9 @@ class PatientsProvider with ChangeNotifier { patientPrescriptionsList .add(new PrescriptionResModel.fromJson(v)); }); + isLoading = false; + isError = false; + this.error = ''; }, onFailure: (String error, int statusCode) { isLoading = false; @@ -300,6 +314,9 @@ class PatientsProvider with ChangeNotifier { response['List_GetRadOreders'].forEach((v) { patientRadiologyList.add(new RadiologyResModel.fromJson(v)); }); + isLoading = false; + isError = false; + this.error = ''; }, onFailure: (String error, int statusCode) { isLoading = false; @@ -343,6 +360,9 @@ class PatientsProvider with ChangeNotifier { await BaseAppClient.post(PATIENT_INSURANCE_APPROVALS_URL, onSuccess: (dynamic response, int statusCode) { insuranceApporvalsList = response['List_ApprovalMain_InPatient']; + isLoading = false; + isError = false; + this.error = ''; }, onFailure: (String error, int statusCode) { isLoading = false; @@ -367,6 +387,9 @@ class PatientsProvider with ChangeNotifier { await BaseAppClient.post(PATIENT_PROGRESS_NOTE_URL, onSuccess: (dynamic response, int statusCode) { patientProgressNoteList = response['List_GetPregressNoteForInPatient']; + isLoading = false; + isError = false; + this.error = ''; }, onFailure: (String error, int statusCode) { isLoading = false; @@ -391,6 +414,9 @@ class PatientsProvider with ChangeNotifier { await BaseAppClient.post(PATIENT_GET_DOCTOR_BY_CLINIC_URL, onSuccess: (dynamic response, int statusCode) { doctorsList = response['List_Doctors_All']; + isLoading = false; + isError = false; + this.error = ''; }, onFailure: (String error, int statusCode) { isLoading = false; @@ -421,6 +447,9 @@ class PatientsProvider with ChangeNotifier { await BaseAppClient.post(PATIENT_GET_CLINIC_BY_PROJECT_URL, onSuccess: (dynamic response, int statusCode) { clinicsList = response['List_Clinic_All']; + isLoading = false; + isError = false; + this.error = ''; }, onFailure: (String error, int statusCode) { isLoading = false; @@ -446,13 +475,15 @@ class PatientsProvider with ChangeNotifier { *@desc: getReferralFrequancyList */ getReferralFrequancyList() async { - String token = await sharedPref.getString(TOKEN); setBasicData(); try { await BaseAppClient.post(PATIENT_GET_LIST_REFERAL_URL, onSuccess: (dynamic response, int statusCode) { referalFrequancyList = response['list_STPReferralFrequency']; + isLoading = false; + isError = false; + this.error = ''; }, onFailure: (String error, int statusCode) { isLoading = false;