FeedListBloc constructor
FeedListBloc({
- FilterFeedModels? filter,
- bool? paged,
- String? orderBy,
- bool? descending,
- bool? detailed,
- EliudQuery? eliudQuery,
- required FeedRepository feedRepository,
- int feedLimit = 5,
Implementation
FeedListBloc(
{this.filter,
this.paged,
this.orderBy,
this.descending,
this.detailed,
this.eliudQuery,
required FeedRepository feedRepository,
this.feedLimit = 5})
: _feedRepository = feedRepository,
super(FeedListLoading()) {
on<LoadFeedList>((event, emit) {
if ((detailed == null) || (!detailed!)) {
_mapLoadFeedListToState();
} else {
_mapLoadFeedListWithDetailsToState();
}
});
on<NewPage>((event, emit) {
pages = pages +
1; // it doesn't matter so much if we increase pages beyond the end
_mapLoadFeedListWithDetailsToState();
});
on<FeedChangeQuery>((event, emit) {
eliudQuery = event.newQuery;
if ((detailed == null) || (!detailed!)) {
_mapLoadFeedListToState();
} else {
_mapLoadFeedListWithDetailsToState();
}
});
on<AddFeedList>((event, emit) async {
await _mapAddFeedListToState(event);
});
on<UpdateFeedList>((event, emit) async {
await _mapUpdateFeedListToState(event);
});
on<DeleteFeedList>((event, emit) async {
await _mapDeleteFeedListToState(event);
});
on<FeedListUpdated>((event, emit) {
emit(_mapFeedListUpdatedToState(event));
});
}