Created
July 5, 2020 09:02
-
-
Save nguyenchilong/39326bd1a04c0a58e062dd93e53b7b56 to your computer and use it in GitHub Desktop.
Revisions
-
nguyenchilong created this gist
Jul 5, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ mport 'package:redux/redux.dart'; import 'package:saidlty/data/model/notification_data.dart'; import 'package:saidlty/redux/action_report.dart'; import 'package:saidlty/redux/app/app_state.dart'; import 'package:saidlty/redux/notification/notification_actions.dart'; class NotificationsViewModel { final Notification notification; final List<Notification> notifications; final Function(bool) getNotifications; final ActionReport getNotificationsReport; NotificationsViewModel({ this.notification, this.notifications, this.getNotifications, this.getNotificationsReport, }); static NotificationsViewModel fromStore(Store<AppState> store) { return NotificationsViewModel( notification: store.state.notificationState.notification, notifications: store.state.notificationState.notifications.values.toList() ?? [], getNotifications: (isRefresh) { store.dispatch(GetNotificationsAction(isRefresh: isRefresh)); }, getNotificationsReport: store.state.notificationState.status["GetNotificationsAction"], ); } }