ChatMemberInfoListBloc constructor

ChatMemberInfoListBloc({
  1. FilterChatMemberInfoModels? filter,
  2. bool? paged,
  3. String? orderBy,
  4. bool? descending,
  5. bool? detailed,
  6. EliudQuery? eliudQuery,
  7. required ChatMemberInfoRepository chatMemberInfoRepository,
  8. int chatMemberInfoLimit = 5,
})

Implementation

ChatMemberInfoListBloc(
    {this.filter,
    this.paged,
    this.orderBy,
    this.descending,
    this.detailed,
    this.eliudQuery,
    required ChatMemberInfoRepository chatMemberInfoRepository,
    this.chatMemberInfoLimit = 5})
    : _chatMemberInfoRepository = chatMemberInfoRepository,
      super(ChatMemberInfoListLoading()) {
  on<LoadChatMemberInfoList>((event, emit) {
    if ((detailed == null) || (!detailed!)) {
      _mapLoadChatMemberInfoListToState();
    } else {
      _mapLoadChatMemberInfoListWithDetailsToState();
    }
  });

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

  on<ChatMemberInfoChangeQuery>((event, emit) {
    eliudQuery = event.newQuery;
    if ((detailed == null) || (!detailed!)) {
      _mapLoadChatMemberInfoListToState();
    } else {
      _mapLoadChatMemberInfoListWithDetailsToState();
    }
  });

  on<AddChatMemberInfoList>((event, emit) async {
    await _mapAddChatMemberInfoListToState(event);
  });

  on<UpdateChatMemberInfoList>((event, emit) async {
    await _mapUpdateChatMemberInfoListToState(event);
  });

  on<DeleteChatMemberInfoList>((event, emit) async {
    await _mapDeleteChatMemberInfoListToState(event);
  });

  on<ChatMemberInfoListUpdated>((event, emit) {
    emit(_mapChatMemberInfoListUpdatedToState(event));
  });
}