Closed alfalcon90 closed 6 months ago
Can you not do set(..., force: true) ?
I also am mostly likely going to make reset public or similar name.
There is also the .overrideWith too
I could use set()
but if I ever change the initialValue I have to make sure every instance of set(initialValue
) is updated. I also have to look up the initialValue every time I want to reset it just to make sure. It just creates more potential for messing something up.
I would recommend using overrideWith
now for computed and signal.
This will update the value/initial value/previous value and also reset the version to 0.
It seems like this workaround is no longer possible: https://github.com/rodydavis/signals.dart/issues/181#issuecomment-1955493463
My current solution is to use extensions but I'm afraid this might break in unpredictable and hard-to-debug ways down the road.