AppPolicyListBloc constructor
AppPolicyListBloc({
- FilterAppPolicyModels? filter,
- bool? paged,
- String? orderBy,
- bool? descending,
- bool? detailed,
- EliudQuery? eliudQuery,
- required AppPolicyRepository appPolicyRepository,
- int appPolicyLimit = 5,
Implementation
AppPolicyListBloc(
{this.filter,
this.paged,
this.orderBy,
this.descending,
this.detailed,
this.eliudQuery,
required AppPolicyRepository appPolicyRepository,
this.appPolicyLimit = 5})
: _appPolicyRepository = appPolicyRepository,
super(AppPolicyListLoading()) {
on<LoadAppPolicyList>((event, emit) {
if ((detailed == null) || (!detailed!)) {
_mapLoadAppPolicyListToState();
} else {
_mapLoadAppPolicyListWithDetailsToState();
}
});
on<NewPage>((event, emit) {
pages = pages +
1; // it doesn't matter so much if we increase pages beyond the end
_mapLoadAppPolicyListWithDetailsToState();
});
on<AppPolicyChangeQuery>((event, emit) {
eliudQuery = event.newQuery;
if ((detailed == null) || (!detailed!)) {
_mapLoadAppPolicyListToState();
} else {
_mapLoadAppPolicyListWithDetailsToState();
}
});
on<AddAppPolicyList>((event, emit) async {
await _mapAddAppPolicyListToState(event);
});
on<UpdateAppPolicyList>((event, emit) async {
await _mapUpdateAppPolicyListToState(event);
});
on<DeleteAppPolicyList>((event, emit) async {
await _mapDeleteAppPolicyListToState(event);
});
on<AppPolicyListUpdated>((event, emit) {
emit(_mapAppPolicyListUpdatedToState(event));
});
}