DividerListBloc constructor
DividerListBloc({
- FilterDividerModels? filter,
- bool? paged,
- String? orderBy,
- bool? descending,
- bool? detailed,
- EliudQuery? eliudQuery,
- required DividerRepository dividerRepository,
- int dividerLimit = 5,
Implementation
DividerListBloc(
{this.filter,
this.paged,
this.orderBy,
this.descending,
this.detailed,
this.eliudQuery,
required DividerRepository dividerRepository,
this.dividerLimit = 5})
: _dividerRepository = dividerRepository,
super(DividerListLoading()) {
on<LoadDividerList>((event, emit) {
if ((detailed == null) || (!detailed!)) {
_mapLoadDividerListToState();
} else {
_mapLoadDividerListWithDetailsToState();
}
});
on<NewPage>((event, emit) {
pages = pages +
1; // it doesn't matter so much if we increase pages beyond the end
_mapLoadDividerListWithDetailsToState();
});
on<DividerChangeQuery>((event, emit) {
eliudQuery = event.newQuery;
if ((detailed == null) || (!detailed!)) {
_mapLoadDividerListToState();
} else {
_mapLoadDividerListWithDetailsToState();
}
});
on<AddDividerList>((event, emit) async {
await _mapAddDividerListToState(event);
});
on<UpdateDividerList>((event, emit) async {
await _mapUpdateDividerListToState(event);
});
on<DeleteDividerList>((event, emit) async {
await _mapDeleteDividerListToState(event);
});
on<DividerListUpdated>((event, emit) {
emit(_mapDividerListUpdatedToState(event));
});
}