AppBarListBloc constructor
AppBarListBloc({
- FilterAppBarModels? filter,
- bool? paged,
- String? orderBy,
- bool? descending,
- bool? detailed,
- EliudQuery? eliudQuery,
- required AppBarRepository appBarRepository,
- int appBarLimit = 5,
Implementation
AppBarListBloc(
{this.filter,
this.paged,
this.orderBy,
this.descending,
this.detailed,
this.eliudQuery,
required AppBarRepository appBarRepository,
this.appBarLimit = 5})
: _appBarRepository = appBarRepository,
super(AppBarListLoading()) {
on<LoadAppBarList>((event, emit) {
if ((detailed == null) || (!detailed!)) {
_mapLoadAppBarListToState();
} else {
_mapLoadAppBarListWithDetailsToState();
}
});
on<NewPage>((event, emit) {
pages = pages +
1; // it doesn't matter so much if we increase pages beyond the end
_mapLoadAppBarListWithDetailsToState();
});
on<AppBarChangeQuery>((event, emit) {
eliudQuery = event.newQuery;
if ((detailed == null) || (!detailed!)) {
_mapLoadAppBarListToState();
} else {
_mapLoadAppBarListWithDetailsToState();
}
});
on<AddAppBarList>((event, emit) async {
await _mapAddAppBarListToState(event);
});
on<UpdateAppBarList>((event, emit) async {
await _mapUpdateAppBarListToState(event);
});
on<DeleteAppBarList>((event, emit) async {
await _mapDeleteAppBarListToState(event);
});
on<AppBarListUpdated>((event, emit) {
emit(_mapAppBarListUpdatedToState(event));
});
}