# ListedItemListBloc constructor Null safety

ListedItemListBloc(

1. {FilterListedItemModels? filter,
2. bool? paged,
3. String? orderBy,
4. bool? descending,
5. bool? detailed,
6. EliudQuery? eliudQuery,
7. required ListedItemRepository listedItemRepository,
8. int listedItemLimit = 5}

)

## Implementation

    ListedItemListBloc(
        {this.filter,
        this.paged,
        this.orderBy,
        this.descending,
        this.detailed,
        this.eliudQuery,
        required ListedItemRepository listedItemRepository,
        this.listedItemLimit = 5})
        : _listedItemRepository = listedItemRepository,
          super(ListedItemListLoading()) {
      on<LoadListedItemList>((event, emit) {
        if ((detailed == null) || (!detailed!)) {
          _mapLoadListedItemListToState();
        } else {
          _mapLoadListedItemListWithDetailsToState();
        }
      });

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

      on<ListedItemChangeQuery>((event, emit) {
        eliudQuery = event.newQuery;
        if ((detailed == null) || (!detailed!)) {
          _mapLoadListedItemListToState();
        } else {
          _mapLoadListedItemListWithDetailsToState();
        }
      });

      on<AddListedItemList>((event, emit) async {
        await _mapAddListedItemListToState(event);
      });

      on<UpdateListedItemList>((event, emit) async {
        await _mapUpdateListedItemListToState(event);
      });

      on<DeleteListedItemList>((event, emit) async {
        await _mapDeleteListedItemListToState(event);
      });

      on<ListedItemListUpdated>((event, emit) {
        emit(_mapListedItemListUpdatedToState(event));
      });
    }