BookletListBloc constructor
BookletListBloc({
- FilterBookletModels? filter,
- bool? paged,
- String? orderBy,
- bool? descending,
- bool? detailed,
- EliudQuery? eliudQuery,
- required BookletRepository bookletRepository,
- int bookletLimit = 5,
Implementation
BookletListBloc(
{this.filter,
this.paged,
this.orderBy,
this.descending,
this.detailed,
this.eliudQuery,
required BookletRepository bookletRepository,
this.bookletLimit = 5})
: _bookletRepository = bookletRepository,
super(BookletListLoading()) {
on<LoadBookletList>((event, emit) {
if ((detailed == null) || (!detailed!)) {
_mapLoadBookletListToState();
} else {
_mapLoadBookletListWithDetailsToState();
}
});
on<NewPage>((event, emit) {
pages = pages +
1; // it doesn't matter so much if we increase pages beyond the end
_mapLoadBookletListWithDetailsToState();
});
on<BookletChangeQuery>((event, emit) {
eliudQuery = event.newQuery;
if ((detailed == null) || (!detailed!)) {
_mapLoadBookletListToState();
} else {
_mapLoadBookletListWithDetailsToState();
}
});
on<AddBookletList>((event, emit) async {
await _mapAddBookletListToState(event);
});
on<UpdateBookletList>((event, emit) async {
await _mapUpdateBookletListToState(event);
});
on<DeleteBookletList>((event, emit) async {
await _mapDeleteBookletListToState(event);
});
on<BookletListUpdated>((event, emit) {
emit(_mapBookletListUpdatedToState(event));
});
}