LabelledBodyComponentListBloc constructor

LabelledBodyComponentListBloc({
  1. FilterLabelledBodyComponentModels? filter,
  2. bool? paged,
  3. String? orderBy,
  4. bool? descending,
  5. bool? detailed,
  6. EliudQuery? eliudQuery,
  7. required LabelledBodyComponentRepository labelledBodyComponentRepository,
  8. int labelledBodyComponentLimit = 5,
})

Implementation

LabelledBodyComponentListBloc(
    {this.filter,
    this.paged,
    this.orderBy,
    this.descending,
    this.detailed,
    this.eliudQuery,
    required LabelledBodyComponentRepository labelledBodyComponentRepository,
    this.labelledBodyComponentLimit = 5})
    : _labelledBodyComponentRepository = labelledBodyComponentRepository,
      super(LabelledBodyComponentListLoading()) {
  on<LoadLabelledBodyComponentList>((event, emit) {
    if ((detailed == null) || (!detailed!)) {
      _mapLoadLabelledBodyComponentListToState();
    } else {
      _mapLoadLabelledBodyComponentListWithDetailsToState();
    }
  });

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

  on<LabelledBodyComponentChangeQuery>((event, emit) {
    eliudQuery = event.newQuery;
    if ((detailed == null) || (!detailed!)) {
      _mapLoadLabelledBodyComponentListToState();
    } else {
      _mapLoadLabelledBodyComponentListWithDetailsToState();
    }
  });

  on<AddLabelledBodyComponentList>((event, emit) async {
    await _mapAddLabelledBodyComponentListToState(event);
  });

  on<UpdateLabelledBodyComponentList>((event, emit) async {
    await _mapUpdateLabelledBodyComponentListToState(event);
  });

  on<DeleteLabelledBodyComponentList>((event, emit) async {
    await _mapDeleteLabelledBodyComponentListToState(event);
  });

  on<LabelledBodyComponentListUpdated>((event, emit) {
    emit(_mapLabelledBodyComponentListUpdatedToState(event));
  });
}