built_redux icon indicating copy to clipboard operation
built_redux copied to clipboard

[Enhancement]: rehydrate store when open app

Open datvtwkm opened this issue 7 years ago • 5 comments

can you add rehydrate store from device storage when open the app? Thank you!

datvtwkm avatar Aug 25 '18 11:08 datvtwkm

You can easily do that yourself, can't you?

zoechi avatar Aug 25 '18 17:08 zoechi

Maybe :D

On Sun, Aug 26, 2018 at 12:20 AM, Günter Zöchbauer <[email protected]

wrote:

You can easily do that yourself, can't you?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/davidmarne/built_redux/issues/93#issuecomment-415984091, or mute the thread https://github.com/notifications/unsubscribe-auth/AcLAYYU0PVTSrc3wGaMyQXAkBuxocKKxks5uUYdYgaJpZM4WMWUx .

datvtwkm avatar Aug 26 '18 09:08 datvtwkm

Yea i think this is easy enough to do by yourself. All you have to do is read the state object from storage before constructing your store and pass that to the store as the store's defaultState parameter.

Did you have a specific idea on a way built_redux could make this easier?

davidmarne avatar Sep 13 '18 03:09 davidmarne

I think redux_persist isn't that so simple how it looks like. Would be much better to have package like that for built_redux

kdela avatar Feb 26 '19 18:02 kdela

I created a example for persisting store with built_redux. Code is based on redux_persist. I didn't want to open source it as package because lack of tests and I think quality is much worse than redux_persist. Maybe in next week I'll have more time to make it right. I'll post it in case that someone need it.

built_redux_persist - persistor + middleware: https://gist.github.com/kdela/5770169aaee1ea1019eb8101266ab5ba

built_redux_persist_flutter - flutter storage (with shared preferences) https://gist.github.com/kdela/21e301344a0699bdd22973b0bb8b260f

store example: https://gist.github.com/kdela/6b8b8c074694cab5858bc137088eda86

kdela avatar Mar 05 '19 14:03 kdela