felangel / felangel/bloc

feat(replay_bloc): expose `List<State>` from `ReplayBloc`/`ReplayCubit` similar to `ReplaySubject`

Open
#3,810 0 comments 0 reactions 0 assignees View on GitHub
enhancement candidate pkg:replay_bloc
Dominant language
Dart
Stars
12.5k
Forks
3.4k
PR merge metrics
No merged PRs in 30d

Description

**Description**

Please consider exposing a `List` from `ReplayBloc`/`ReplayCubit` similar to `ReplaySubject`. This would allow for easy access to previous `limit` number of states.

**Desired Solution**

I would like to have handy access to previous states without having to manually cache them. Also you could allow specifying no of steps to `undo`/`redo`, e.g.: `undo([int steps = 1])`. Maybe even using an index, e.g.: `undoToIndex(int index)` which could be helpful to reset say a `HydratedBloc` used in conjuncture with a `ReplayBloc` to initial state at any given point with `undoToIndex(0)`.
Might be some value to also allowing `undoTo(State state)` even though a state could be directly emitted.

**Alternatives Considered**

Manually caching states, which is not scalable/reusable.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.