MonaStyleAttributesListBloc constructor

MonaStyleAttributesListBloc({
  1. FilterMonaStyleAttributesModels? filter,
  2. bool? paged,
  3. String? orderBy,
  4. bool? descending,
  5. bool? detailed,
  6. EliudQuery? eliudQuery,
  7. required MonaStyleAttributesRepository monaStyleAttributesRepository,
  8. int monaStyleAttributesLimit = 5,
})

Implementation

MonaStyleAttributesListBloc(
    {this.filter,
    this.paged,
    this.orderBy,
    this.descending,
    this.detailed,
    this.eliudQuery,
    required MonaStyleAttributesRepository monaStyleAttributesRepository,
    this.monaStyleAttributesLimit = 5})
    : _monaStyleAttributesRepository = monaStyleAttributesRepository,
      super(MonaStyleAttributesListLoading()) {
  on<LoadMonaStyleAttributesList>((event, emit) {
    if ((detailed == null) || (!detailed!)) {
      _mapLoadMonaStyleAttributesListToState();
    } else {
      _mapLoadMonaStyleAttributesListWithDetailsToState();
    }
  });

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

  on<MonaStyleAttributesChangeQuery>((event, emit) {
    eliudQuery = event.newQuery;
    if ((detailed == null) || (!detailed!)) {
      _mapLoadMonaStyleAttributesListToState();
    } else {
      _mapLoadMonaStyleAttributesListWithDetailsToState();
    }
  });

  on<AddMonaStyleAttributesList>((event, emit) async {
    await _mapAddMonaStyleAttributesListToState(event);
  });

  on<UpdateMonaStyleAttributesList>((event, emit) async {
    await _mapUpdateMonaStyleAttributesListToState(event);
  });

  on<DeleteMonaStyleAttributesList>((event, emit) async {
    await _mapDeleteMonaStyleAttributesListToState(event);
  });

  on<MonaStyleAttributesListUpdated>((event, emit) {
    emit(_mapMonaStyleAttributesListUpdatedToState(event));
  });
}