BlockingListBloc constructor

BlockingListBloc({
  1. FilterBlockingModels? filter,
  2. bool? paged,
  3. String? orderBy,
  4. bool? descending,
  5. bool? detailed,
  6. EliudQuery? eliudQuery,
  7. required BlockingRepository blockingRepository,
  8. int blockingLimit = 5,
})

Implementation

BlockingListBloc(
    {this.filter,
    this.paged,
    this.orderBy,
    this.descending,
    this.detailed,
    this.eliudQuery,
    required BlockingRepository blockingRepository,
    this.blockingLimit = 5})
    : _blockingRepository = blockingRepository,
      super(BlockingListLoading()) {
  on<LoadBlockingList>((event, emit) {
    if ((detailed == null) || (!detailed!)) {
      _mapLoadBlockingListToState();
    } else {
      _mapLoadBlockingListWithDetailsToState();
    }
  });

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

  on<BlockingChangeQuery>((event, emit) {
    eliudQuery = event.newQuery;
    if ((detailed == null) || (!detailed!)) {
      _mapLoadBlockingListToState();
    } else {
      _mapLoadBlockingListWithDetailsToState();
    }
  });

  on<AddBlockingList>((event, emit) async {
    await _mapAddBlockingListToState(event);
  });

  on<UpdateBlockingList>((event, emit) async {
    await _mapUpdateBlockingListToState(event);
  });

  on<DeleteBlockingList>((event, emit) async {
    await _mapDeleteBlockingListToState(event);
  });

  on<BlockingListUpdated>((event, emit) {
    emit(_mapBlockingListUpdatedToState(event));
  });
}