AlbumListBloc constructor
AlbumListBloc({
- FilterAlbumModels? filter,
- bool? paged,
- String? orderBy,
- bool? descending,
- bool? detailed,
- EliudQuery? eliudQuery,
- required AlbumRepository albumRepository,
- int albumLimit = 5,
Implementation
AlbumListBloc(
{this.filter,
this.paged,
this.orderBy,
this.descending,
this.detailed,
this.eliudQuery,
required AlbumRepository albumRepository,
this.albumLimit = 5})
: _albumRepository = albumRepository,
super(AlbumListLoading()) {
on<LoadAlbumList>((event, emit) {
if ((detailed == null) || (!detailed!)) {
_mapLoadAlbumListToState();
} else {
_mapLoadAlbumListWithDetailsToState();
}
});
on<NewPage>((event, emit) {
pages = pages +
1; // it doesn't matter so much if we increase pages beyond the end
_mapLoadAlbumListWithDetailsToState();
});
on<AlbumChangeQuery>((event, emit) {
eliudQuery = event.newQuery;
if ((detailed == null) || (!detailed!)) {
_mapLoadAlbumListToState();
} else {
_mapLoadAlbumListWithDetailsToState();
}
});
on<AddAlbumList>((event, emit) async {
await _mapAddAlbumListToState(event);
});
on<UpdateAlbumList>((event, emit) async {
await _mapUpdateAlbumListToState(event);
});
on<DeleteAlbumList>((event, emit) async {
await _mapDeleteAlbumListToState(event);
});
on<AlbumListUpdated>((event, emit) {
emit(_mapAlbumListUpdatedToState(event));
});
}