DividerListBloc constructor

DividerListBloc({
  1. FilterDividerModels? filter,
  2. bool? paged,
  3. String? orderBy,
  4. bool? descending,
  5. bool? detailed,
  6. EliudQuery? eliudQuery,
  7. required DividerRepository dividerRepository,
  8. int dividerLimit = 5,
})

Implementation

DividerListBloc(
    {this.filter,
    this.paged,
    this.orderBy,
    this.descending,
    this.detailed,
    this.eliudQuery,
    required DividerRepository dividerRepository,
    this.dividerLimit = 5})
    : _dividerRepository = dividerRepository,
      super(DividerListLoading()) {
  on<LoadDividerList>((event, emit) {
    if ((detailed == null) || (!detailed!)) {
      _mapLoadDividerListToState();
    } else {
      _mapLoadDividerListWithDetailsToState();
    }
  });

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

  on<DividerChangeQuery>((event, emit) {
    eliudQuery = event.newQuery;
    if ((detailed == null) || (!detailed!)) {
      _mapLoadDividerListToState();
    } else {
      _mapLoadDividerListWithDetailsToState();
    }
  });

  on<AddDividerList>((event, emit) async {
    await _mapAddDividerListToState(event);
  });

  on<UpdateDividerList>((event, emit) async {
    await _mapUpdateDividerListToState(event);
  });

  on<DeleteDividerList>((event, emit) async {
    await _mapDeleteDividerListToState(event);
  });

  on<DividerListUpdated>((event, emit) {
    emit(_mapDividerListUpdatedToState(event));
  });
}