DialogListBloc constructor
DialogListBloc({
- FilterDialogModels? filter,
- bool? paged,
- String? orderBy,
- bool? descending,
- bool? detailed,
- EliudQuery? eliudQuery,
- required DialogRepository dialogRepository,
- int dialogLimit = 5,
Implementation
DialogListBloc(
{this.filter,
this.paged,
this.orderBy,
this.descending,
this.detailed,
this.eliudQuery,
required DialogRepository dialogRepository,
this.dialogLimit = 5})
: _dialogRepository = dialogRepository,
super(DialogListLoading()) {
on<LoadDialogList>((event, emit) {
if ((detailed == null) || (!detailed!)) {
_mapLoadDialogListToState();
} else {
_mapLoadDialogListWithDetailsToState();
}
});
on<NewPage>((event, emit) {
pages = pages +
1; // it doesn't matter so much if we increase pages beyond the end
_mapLoadDialogListWithDetailsToState();
});
on<DialogChangeQuery>((event, emit) {
eliudQuery = event.newQuery;
if ((detailed == null) || (!detailed!)) {
_mapLoadDialogListToState();
} else {
_mapLoadDialogListWithDetailsToState();
}
});
on<AddDialogList>((event, emit) async {
await _mapAddDialogListToState(event);
});
on<UpdateDialogList>((event, emit) async {
await _mapUpdateDialogListToState(event);
});
on<DeleteDialogList>((event, emit) async {
await _mapDeleteDialogListToState(event);
});
on<DialogListUpdated>((event, emit) {
emit(_mapDialogListUpdatedToState(event));
});
}