BlockingListBloc constructor
BlockingListBloc({
- FilterBlockingModels? filter,
- bool? paged,
- String? orderBy,
- bool? descending,
- bool? detailed,
- EliudQuery? eliudQuery,
- required BlockingRepository blockingRepository,
- int blockingLimit = 5,
Implementation
BlockingListBloc(
{this.filter,
this.paged,
this.orderBy,
this.descending,
this.detailed,
this.eliudQuery,
required BlockingRepository blockingRepository,
this.blockingLimit = 5})
: _blockingRepository = blockingRepository,
super(BlockingListLoading()) {
on<LoadBlockingList>((event, emit) {
if ((detailed == null) || (!detailed!)) {
_mapLoadBlockingListToState();
} else {
_mapLoadBlockingListWithDetailsToState();
}
});
on<NewPage>((event, emit) {
pages = pages +
1; // it doesn't matter so much if we increase pages beyond the end
_mapLoadBlockingListWithDetailsToState();
});
on<BlockingChangeQuery>((event, emit) {
eliudQuery = event.newQuery;
if ((detailed == null) || (!detailed!)) {
_mapLoadBlockingListToState();
} else {
_mapLoadBlockingListWithDetailsToState();
}
});
on<AddBlockingList>((event, emit) async {
await _mapAddBlockingListToState(event);
});
on<UpdateBlockingList>((event, emit) async {
await _mapUpdateBlockingListToState(event);
});
on<DeleteBlockingList>((event, emit) async {
await _mapDeleteBlockingListToState(event);
});
on<BlockingListUpdated>((event, emit) {
emit(_mapBlockingListUpdatedToState(event));
});
}