FeedListBloc constructor

FeedListBloc({
  1. FilterFeedModels? filter,
  2. bool? paged,
  3. String? orderBy,
  4. bool? descending,
  5. bool? detailed,
  6. EliudQuery? eliudQuery,
  7. required FeedRepository feedRepository,
  8. int feedLimit = 5,
})

Implementation

FeedListBloc(
    {this.filter,
    this.paged,
    this.orderBy,
    this.descending,
    this.detailed,
    this.eliudQuery,
    required FeedRepository feedRepository,
    this.feedLimit = 5})
    : _feedRepository = feedRepository,
      super(FeedListLoading()) {
  on<LoadFeedList>((event, emit) {
    if ((detailed == null) || (!detailed!)) {
      _mapLoadFeedListToState();
    } else {
      _mapLoadFeedListWithDetailsToState();
    }
  });

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

  on<FeedChangeQuery>((event, emit) {
    eliudQuery = event.newQuery;
    if ((detailed == null) || (!detailed!)) {
      _mapLoadFeedListToState();
    } else {
      _mapLoadFeedListWithDetailsToState();
    }
  });

  on<AddFeedList>((event, emit) async {
    await _mapAddFeedListToState(event);
  });

  on<UpdateFeedList>((event, emit) async {
    await _mapUpdateFeedListToState(event);
  });

  on<DeleteFeedList>((event, emit) async {
    await _mapDeleteFeedListToState(event);
  });

  on<FeedListUpdated>((event, emit) {
    emit(_mapFeedListUpdatedToState(event));
  });
}