PresentationListBloc constructor

PresentationListBloc({
  1. FilterPresentationModels? filter,
  2. bool? paged,
  3. String? orderBy,
  4. bool? descending,
  5. bool? detailed,
  6. EliudQuery? eliudQuery,
  7. required PresentationRepository presentationRepository,
  8. int presentationLimit = 5,
})

Implementation

PresentationListBloc(
    {this.filter,
    this.paged,
    this.orderBy,
    this.descending,
    this.detailed,
    this.eliudQuery,
    required PresentationRepository presentationRepository,
    this.presentationLimit = 5})
    : _presentationRepository = presentationRepository,
      super(PresentationListLoading()) {
  on<LoadPresentationList>((event, emit) {
    if ((detailed == null) || (!detailed!)) {
      _mapLoadPresentationListToState();
    } else {
      _mapLoadPresentationListWithDetailsToState();
    }
  });

  on<NewPage>((event, emit) {
    pages = pages +
        1; // it doesn't matter so much if we increase pages beyond the end
    _mapLoadPresentationListWithDetailsToState();
  });

  on<PresentationChangeQuery>((event, emit) {
    eliudQuery = event.newQuery;
    if ((detailed == null) || (!detailed!)) {
      _mapLoadPresentationListToState();
    } else {
      _mapLoadPresentationListWithDetailsToState();
    }
  });

  on<AddPresentationList>((event, emit) async {
    await _mapAddPresentationListToState(event);
  });

  on<UpdatePresentationList>((event, emit) async {
    await _mapUpdatePresentationListToState(event);
  });

  on<DeletePresentationList>((event, emit) async {
    await _mapDeletePresentationListToState(event);
  });

  on<PresentationListUpdated>((event, emit) {
    emit(_mapPresentationListUpdatedToState(event));
  });
}