SimpleTextListBloc constructor
SimpleTextListBloc({
- FilterSimpleTextModels? filter,
- bool? paged,
- String? orderBy,
- bool? descending,
- bool? detailed,
- EliudQuery? eliudQuery,
- required SimpleTextRepository simpleTextRepository,
- int simpleTextLimit = 5,
Implementation
SimpleTextListBloc(
{this.filter,
this.paged,
this.orderBy,
this.descending,
this.detailed,
this.eliudQuery,
required SimpleTextRepository simpleTextRepository,
this.simpleTextLimit = 5})
: _simpleTextRepository = simpleTextRepository,
super(SimpleTextListLoading()) {
on<LoadSimpleTextList>((event, emit) {
if ((detailed == null) || (!detailed!)) {
_mapLoadSimpleTextListToState();
} else {
_mapLoadSimpleTextListWithDetailsToState();
}
});
on<NewPage>((event, emit) {
pages = pages +
1; // it doesn't matter so much if we increase pages beyond the end
_mapLoadSimpleTextListWithDetailsToState();
});
on<SimpleTextChangeQuery>((event, emit) {
eliudQuery = event.newQuery;
if ((detailed == null) || (!detailed!)) {
_mapLoadSimpleTextListToState();
} else {
_mapLoadSimpleTextListWithDetailsToState();
}
});
on<AddSimpleTextList>((event, emit) async {
await _mapAddSimpleTextListToState(event);
});
on<UpdateSimpleTextList>((event, emit) async {
await _mapUpdateSimpleTextListToState(event);
});
on<DeleteSimpleTextList>((event, emit) async {
await _mapDeleteSimpleTextListToState(event);
});
on<SimpleTextListUpdated>((event, emit) {
emit(_mapSimpleTextListUpdatedToState(event));
});
}