ChatDashboardListBloc constructor
ChatDashboardListBloc({
- FilterChatDashboardModels? filter,
- bool? paged,
- String? orderBy,
- bool? descending,
- bool? detailed,
- EliudQuery? eliudQuery,
- required ChatDashboardRepository chatDashboardRepository,
- int chatDashboardLimit = 5,
Implementation
ChatDashboardListBloc(
{this.filter,
this.paged,
this.orderBy,
this.descending,
this.detailed,
this.eliudQuery,
required ChatDashboardRepository chatDashboardRepository,
this.chatDashboardLimit = 5})
: _chatDashboardRepository = chatDashboardRepository,
super(ChatDashboardListLoading()) {
on<LoadChatDashboardList>((event, emit) {
if ((detailed == null) || (!detailed!)) {
_mapLoadChatDashboardListToState();
} else {
_mapLoadChatDashboardListWithDetailsToState();
}
});
on<NewPage>((event, emit) {
pages = pages +
1; // it doesn't matter so much if we increase pages beyond the end
_mapLoadChatDashboardListWithDetailsToState();
});
on<ChatDashboardChangeQuery>((event, emit) {
eliudQuery = event.newQuery;
if ((detailed == null) || (!detailed!)) {
_mapLoadChatDashboardListToState();
} else {
_mapLoadChatDashboardListWithDetailsToState();
}
});
on<AddChatDashboardList>((event, emit) async {
await _mapAddChatDashboardListToState(event);
});
on<UpdateChatDashboardList>((event, emit) async {
await _mapUpdateChatDashboardListToState(event);
});
on<DeleteChatDashboardList>((event, emit) async {
await _mapDeleteChatDashboardListToState(event);
});
on<ChatDashboardListUpdated>((event, emit) {
emit(_mapChatDashboardListUpdatedToState(event));
});
}