TutorialListBloc constructor
TutorialListBloc({
- FilterTutorialModels? filter,
- bool? paged,
- String? orderBy,
- bool? descending,
- bool? detailed,
- EliudQuery? eliudQuery,
- required TutorialRepository tutorialRepository,
- int tutorialLimit = 5,
Implementation
TutorialListBloc(
{this.filter,
this.paged,
this.orderBy,
this.descending,
this.detailed,
this.eliudQuery,
required TutorialRepository tutorialRepository,
this.tutorialLimit = 5})
: _tutorialRepository = tutorialRepository,
super(TutorialListLoading()) {
on<LoadTutorialList>((event, emit) {
if ((detailed == null) || (!detailed!)) {
_mapLoadTutorialListToState();
} else {
_mapLoadTutorialListWithDetailsToState();
}
});
on<NewPage>((event, emit) {
pages = pages +
1; // it doesn't matter so much if we increase pages beyond the end
_mapLoadTutorialListWithDetailsToState();
});
on<TutorialChangeQuery>((event, emit) {
eliudQuery = event.newQuery;
if ((detailed == null) || (!detailed!)) {
_mapLoadTutorialListToState();
} else {
_mapLoadTutorialListWithDetailsToState();
}
});
on<AddTutorialList>((event, emit) async {
await _mapAddTutorialListToState(event);
});
on<UpdateTutorialList>((event, emit) async {
await _mapUpdateTutorialListToState(event);
});
on<DeleteTutorialList>((event, emit) async {
await _mapDeleteTutorialListToState(event);
});
on<TutorialListUpdated>((event, emit) {
emit(_mapTutorialListUpdatedToState(event));
});
}