# SectionListBloc constructor Null safety

SectionListBloc(

1. {FilterSectionModels? filter,
2. bool? paged,
3. String? orderBy,
4. bool? descending,
5. bool? detailed,
6. EliudQuery? eliudQuery,
7. required SectionRepository sectionRepository,
8. int sectionLimit = 5}

)

## Implementation

    SectionListBloc(
        {this.filter,
        this.paged,
        this.orderBy,
        this.descending,
        this.detailed,
        this.eliudQuery,
        required SectionRepository sectionRepository,
        this.sectionLimit = 5})
        : _sectionRepository = sectionRepository,
          super(SectionListLoading()) {
      on<LoadSectionList>((event, emit) {
        if ((detailed == null) || (!detailed!)) {
          _mapLoadSectionListToState();
        } else {
          _mapLoadSectionListWithDetailsToState();
        }
      });

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

      on<SectionChangeQuery>((event, emit) {
        eliudQuery = event.newQuery;
        if ((detailed == null) || (!detailed!)) {
          _mapLoadSectionListToState();
        } else {
          _mapLoadSectionListWithDetailsToState();
        }
      });

      on<AddSectionList>((event, emit) async {
        await _mapAddSectionListToState(event);
      });

      on<UpdateSectionList>((event, emit) async {
        await _mapUpdateSectionListToState(event);
      });

      on<DeleteSectionList>((event, emit) async {
        await _mapDeleteSectionListToState(event);
      });

      on<SectionListUpdated>((event, emit) {
        emit(_mapSectionListUpdatedToState(event));
      });
    }