replay_cubit 0.1.0 replay_cubit: ^0.1.0 copied to clipboard
An extension to the cubit state management library which adds support for undo and redo.
An extension to the cubit state management library which adds support for undo and redo.
Creating a ReplayCubit #
class CounterCubit extends ReplayCubit<int> {
CounterCubit() : super(0);
void increment() => emit(state + 1);
}
Using a ReplayCubit #
void main() async {
final cubit = CounterCubit();
// trigger a state change
cubit.increment();
print(cubit.state); // 1
// undo the change
cubit.undo();
print(cubit.state); // 0
// redo the change
cubit.redo();
print(cubit.state); // 1
}
Dart Versions #
- Dart 2: >= 2.7.0
Maintainers #
Starware #
ReplayCubit is Starware.
This means you're free to use the project, as long as you star its GitHub repository.
Your appreciation makes us grow and glow up. ⭐