NotificationListBloc constructor
NotificationListBloc({
- FilterNotificationModels? filter,
- bool? paged,
- String? orderBy,
- bool? descending,
- bool? detailed,
- EliudQuery? eliudQuery,
- required NotificationRepository notificationRepository,
- int notificationLimit = 5,
Implementation
NotificationListBloc(
{this.filter,
this.paged,
this.orderBy,
this.descending,
this.detailed,
this.eliudQuery,
required NotificationRepository notificationRepository,
this.notificationLimit = 5})
: _notificationRepository = notificationRepository,
super(NotificationListLoading()) {
on<LoadNotificationList>((event, emit) {
if ((detailed == null) || (!detailed!)) {
_mapLoadNotificationListToState();
} else {
_mapLoadNotificationListWithDetailsToState();
}
});
on<NewPage>((event, emit) {
pages = pages +
1; // it doesn't matter so much if we increase pages beyond the end
_mapLoadNotificationListWithDetailsToState();
});
on<NotificationChangeQuery>((event, emit) {
eliudQuery = event.newQuery;
if ((detailed == null) || (!detailed!)) {
_mapLoadNotificationListToState();
} else {
_mapLoadNotificationListWithDetailsToState();
}
});
on<AddNotificationList>((event, emit) async {
await _mapAddNotificationListToState(event);
});
on<UpdateNotificationList>((event, emit) async {
await _mapUpdateNotificationListToState(event);
});
on<DeleteNotificationList>((event, emit) async {
await _mapDeleteNotificationListToState(event);
});
on<NotificationListUpdated>((event, emit) {
emit(_mapNotificationListUpdatedToState(event));
});
}