TutorialEntryListBloc constructor Null safety

TutorialEntryListBloc(
  1. {FilterTutorialEntryModels? filter,
  2. bool? paged,
  3. String? orderBy,
  4. bool? descending,
  5. bool? detailed,
  6. EliudQuery? eliudQuery,
  7. required TutorialEntryRepository tutorialEntryRepository,
  8. int tutorialEntryLimit = 5}
)

Implementation

TutorialEntryListBloc(
    {this.filter,
    this.paged,
    this.orderBy,
    this.descending,
    this.detailed,
    this.eliudQuery,
    required TutorialEntryRepository tutorialEntryRepository,
    this.tutorialEntryLimit = 5})
    : _tutorialEntryRepository = tutorialEntryRepository,
      super(TutorialEntryListLoading()) {
  on<LoadTutorialEntryList>((event, emit) {
    if ((detailed == null) || (!detailed!)) {
      _mapLoadTutorialEntryListToState();
    } else {
      _mapLoadTutorialEntryListWithDetailsToState();
    }
  });

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

  on<TutorialEntryChangeQuery>((event, emit) {
    eliudQuery = event.newQuery;
    if ((detailed == null) || (!detailed!)) {
      _mapLoadTutorialEntryListToState();
    } else {
      _mapLoadTutorialEntryListWithDetailsToState();
    }
  });

  on<AddTutorialEntryList>((event, emit) async {
    await _mapAddTutorialEntryListToState(event);
  });

  on<UpdateTutorialEntryList>((event, emit) async {
    await _mapUpdateTutorialEntryListToState(event);
  });

  on<DeleteTutorialEntryList>((event, emit) async {
    await _mapDeleteTutorialEntryListToState(event);
  });

  on<TutorialEntryListUpdated>((event, emit) {
    emit(_mapTutorialEntryListUpdatedToState(event));
  });
}