GridListBloc constructor
GridListBloc({
- FilterGridModels? filter,
- bool? paged,
- String? orderBy,
- bool? descending,
- bool? detailed,
- EliudQuery? eliudQuery,
- required GridRepository gridRepository,
- int gridLimit = 5,
Implementation
GridListBloc(
{this.filter,
this.paged,
this.orderBy,
this.descending,
this.detailed,
this.eliudQuery,
required GridRepository gridRepository,
this.gridLimit = 5})
: _gridRepository = gridRepository,
super(GridListLoading()) {
on<LoadGridList>((event, emit) {
if ((detailed == null) || (!detailed!)) {
_mapLoadGridListToState();
} else {
_mapLoadGridListWithDetailsToState();
}
});
on<NewPage>((event, emit) {
pages = pages +
1; // it doesn't matter so much if we increase pages beyond the end
_mapLoadGridListWithDetailsToState();
});
on<GridChangeQuery>((event, emit) {
eliudQuery = event.newQuery;
if ((detailed == null) || (!detailed!)) {
_mapLoadGridListToState();
} else {
_mapLoadGridListWithDetailsToState();
}
});
on<AddGridList>((event, emit) async {
await _mapAddGridListToState(event);
});
on<UpdateGridList>((event, emit) async {
await _mapUpdateGridListToState(event);
});
on<DeleteGridList>((event, emit) async {
await _mapDeleteGridListToState(event);
});
on<GridListUpdated>((event, emit) {
emit(_mapGridListUpdatedToState(event));
});
}