rrousselGit / state_notifier

ValueNotifier, but outside Flutter and with some extra perks
MIT License
311 stars 28 forks source link

adding undo/redo #25

Closed rodydavis closed 4 years ago

rodydavis commented 4 years ago
mono0926 commented 4 years ago

It adds additional cost(mainly memory). How about implement as a mixin?

rodydavis commented 4 years ago

It can have a max set on the tracked changes. And not sure if it can be a mixin as I need to intercept the setter on value

rodydavis commented 4 years ago

I added 0 to the tracked changes by default. This means that it will have not memory impact. By adding -1 to maxTrackedChanges it will have an unbounded history and a number greater than 0 will remove the oldest change from the stack when it reaches the max.

rrousselGit commented 4 years ago

We'll want some tests for that + documentation Also, if not for a mix-in, we can have a different base class. Like UndoableStateNotifier.

rodydavis commented 4 years ago

What about TrackedStateNotifier? I can create a new base class and write some tests