genisgo / rdart

0 stars 0 forks source link

Short time problem between object reconstructions and state change #2

Open genisgo opened 9 months ago

genisgo commented 9 months ago

The case occurs when using local storage with BlocBuilder. The state sends the data stream faster than the reconstruction of the object at each state change

  on<FilierGetAllEvent>((event, emit) async {
      emit(FiliereLoading());
     // await Future.delayed(Duration(seconds: 1)); (without delay the problem this product)
      final filieres = await getAllFilliere(NoParam());
      filieres.leftOrRightOne((list) {
        emit(FiliereLoaded(listFiliere: list!));
      }, (right) {
        emit(
            FiliereLoadingError(currentEvent: event, message: right!.message!));
      });