ProfileListBloc constructor
ProfileListBloc({
- FilterProfileModels? filter,
- bool? paged,
- String? orderBy,
- bool? descending,
- bool? detailed,
- EliudQuery? eliudQuery,
- required ProfileRepository profileRepository,
- int profileLimit = 5,
Implementation
ProfileListBloc(
{this.filter,
this.paged,
this.orderBy,
this.descending,
this.detailed,
this.eliudQuery,
required ProfileRepository profileRepository,
this.profileLimit = 5})
: _profileRepository = profileRepository,
super(ProfileListLoading()) {
on<LoadProfileList>((event, emit) {
if ((detailed == null) || (!detailed!)) {
_mapLoadProfileListToState();
} else {
_mapLoadProfileListWithDetailsToState();
}
});
on<NewPage>((event, emit) {
pages = pages +
1; // it doesn't matter so much if we increase pages beyond the end
_mapLoadProfileListWithDetailsToState();
});
on<ProfileChangeQuery>((event, emit) {
eliudQuery = event.newQuery;
if ((detailed == null) || (!detailed!)) {
_mapLoadProfileListToState();
} else {
_mapLoadProfileListWithDetailsToState();
}
});
on<AddProfileList>((event, emit) async {
await _mapAddProfileListToState(event);
});
on<UpdateProfileList>((event, emit) async {
await _mapUpdateProfileListToState(event);
});
on<DeleteProfileList>((event, emit) async {
await _mapDeleteProfileListToState(event);
});
on<ProfileListUpdated>((event, emit) {
emit(_mapProfileListUpdatedToState(event));
});
}