# BookletListBloc constructor Null safety

BookletListBloc(

1. {FilterBookletModels? filter,
2. bool? paged,
3. String? orderBy,
4. bool? descending,
5. bool? detailed,
6. EliudQuery? eliudQuery,
7. required BookletRepository bookletRepository,
8. int bookletLimit = 5}

)

## Implementation

    BookletListBloc(
        {this.filter,
        this.paged,
        this.orderBy,
        this.descending,
        this.detailed,
        this.eliudQuery,
        required BookletRepository bookletRepository,
        this.bookletLimit = 5})
        : _bookletRepository = bookletRepository,
          super(BookletListLoading()) {
      on<LoadBookletList>((event, emit) {
        if ((detailed == null) || (!detailed!)) {
          _mapLoadBookletListToState();
        } else {
          _mapLoadBookletListWithDetailsToState();
        }
      });

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

      on<BookletChangeQuery>((event, emit) {
        eliudQuery = event.newQuery;
        if ((detailed == null) || (!detailed!)) {
          _mapLoadBookletListToState();
        } else {
          _mapLoadBookletListWithDetailsToState();
        }
      });

      on<AddBookletList>((event, emit) async {
        await _mapAddBookletListToState(event);
      });

      on<UpdateBookletList>((event, emit) async {
        await _mapUpdateBookletListToState(event);
      });

      on<DeleteBookletList>((event, emit) async {
        await _mapDeleteBookletListToState(event);
      });

      on<BookletListUpdated>((event, emit) {
        emit(_mapBookletListUpdatedToState(event));
      });
    }