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.
hmg_nurses/lib/provider/dashboard_provider_model.dart

36 lines
1.3 KiB
Dart

import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:hmg_nurses/model/base/generic_response_model2.dart';
import 'package:hmg_nurses/provider/base_vm.dart';
import 'package:hmg_nurses/services/api_repo/dashboard_api_repo.dart';
import 'package:injector/injector.dart';
import '../classes/utils.dart';
import '../main.dart';
/// Mix-in [DiagnosticableTreeMixin] to have access to [debugFillProperties] for the devtool
// ignore: prefer_mixin
class DashboardProviderModel extends BaseViewModel {
final IDashboardApiRepo _loginApiRepo = Injector.appInstance.get<IDashboardApiRepo>();
Future<GenericResponseModel2?> getDocProfile() async {
try {
Utils.showLoading();
// Utils.showToast(deviceInfo.length.toString());
GenericResponseModel2 docProfileModel = await _loginApiRepo.getDoctorProfile();
appState.doctorProfile = docProfileModel;
await _loginApiRepo.insertDoctorProfile();
Utils.hideLoading();
return docProfileModel;
} catch (e) {
Utils.hideLoading();
Utils.handleException(e, navigatorKey.currentContext!, (msg) {
Utils.confirmDialog(navigatorKey.currentContext!, msg);
});
}
return null;
}
}