ShopFrontListBloc constructor
ShopFrontListBloc({
- FilterShopFrontModels? filter,
- bool? paged,
- String? orderBy,
- bool? descending,
- bool? detailed,
- EliudQuery? eliudQuery,
- required ShopFrontRepository shopFrontRepository,
- int shopFrontLimit = 5,
Implementation
ShopFrontListBloc(
{this.filter,
this.paged,
this.orderBy,
this.descending,
this.detailed,
this.eliudQuery,
required ShopFrontRepository shopFrontRepository,
this.shopFrontLimit = 5})
: _shopFrontRepository = shopFrontRepository,
super(ShopFrontListLoading()) {
on<LoadShopFrontList>((event, emit) {
if ((detailed == null) || (!detailed!)) {
_mapLoadShopFrontListToState();
} else {
_mapLoadShopFrontListWithDetailsToState();
}
});
on<NewPage>((event, emit) {
pages = pages +
1; // it doesn't matter so much if we increase pages beyond the end
_mapLoadShopFrontListWithDetailsToState();
});
on<ShopFrontChangeQuery>((event, emit) {
eliudQuery = event.newQuery;
if ((detailed == null) || (!detailed!)) {
_mapLoadShopFrontListToState();
} else {
_mapLoadShopFrontListWithDetailsToState();
}
});
on<AddShopFrontList>((event, emit) async {
await _mapAddShopFrontListToState(event);
});
on<UpdateShopFrontList>((event, emit) async {
await _mapUpdateShopFrontListToState(event);
});
on<DeleteShopFrontList>((event, emit) async {
await _mapDeleteShopFrontListToState(event);
});
on<ShopFrontListUpdated>((event, emit) {
emit(_mapShopFrontListUpdatedToState(event));
});
}