import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_request_model.dart'; import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_response_model.dart'; import 'package:diplomaticquarterapp/core/service/notifications_service.dart'; import '../../locator.dart'; import 'base_view_model.dart'; class NotificationViewModel extends BaseViewModel { NotificationService _notificationService = locator(); List get notifications => _notificationService.notificationsList; Future getNotifications() async { setState(ViewState.Busy); GetNotificationsRequestModel getNotificationsRequestModel = new GetNotificationsRequestModel(currentPage: 0,pagingSize: 14,notificationStatusID: 2); await _notificationService.getAllNotifications(getNotificationsRequestModel); if (_notificationService.hasError) { error = _notificationService.error; setState(ViewState.Error); } else setState(ViewState.Idle); } }