import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/models/request_doctor_reply.dart'; import 'package:doctor_app_flutter/models/list_gt_my_pationents_question_model.dart'; import 'package:flutter/cupertino.dart'; class DoctorReplyProvider with ChangeNotifier { List listDoctorWorkingHoursTable = []; bool isLoading = true; bool isError = false; String error = ''; RequestDoctorReply _requestDoctorReply = RequestDoctorReply(); DoctorReplyProvider() { getDoctorReply(); } getDoctorReply() async { try { await BaseAppClient.post( 'DoctorApplication.svc/REST/GtMyPatientsQuestions', body: _requestDoctorReply.toJson(), onSuccess: (dynamic response, int statusCode) { response['List_GtMyPatientsQuestions'].forEach((v) { listDoctorWorkingHoursTable .add(ListGtMyPatientsQuestions.fromJson(v)); isError = false; isLoading = false; }); }, onFailure: (String error, int statusCode) { isError = true; isLoading = false; this.error = error; }); notifyListeners(); } catch (error) { throw error; } } }