You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
doctor_app_flutter/lib/providers/doctor_reply_provider.dart

42 lines
1.2 KiB
Dart

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<ListGtMyPatientsQuestions> 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;
}
}
}