Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different between shared preference and using redux

What are the differences between SharedPreferences and Redux, especially in flutter? Redux provides a global state in app. So which is the most powerful of the two? What are the biggest important things that I should know about these 2 different things?

like image 884
Ray Coder Avatar asked Feb 23 '26 01:02

Ray Coder


1 Answers

SharedPreferences and Redux are two very different things with different purposes all together.

Redux, as you said, allows you to share a global state across your app. But the data in that state/store is volatile. If you restart your app, the data will be gone. Its main purpose is to share data to any part of your app.

SharedPreferences works like a local storage on the device. It uses NSUserDefaults (on iOS) and SharedPreferences (on Android). It's meant to store key - value pairs. Small amounts of information that are kept even if your app is closed. It's not meant to be used as a DataBase. It's main purpose is typically to store tokens, small amounts of user data or any other bits that you may need.

like image 86
João Soares Avatar answered Feb 25 '26 08:02

João Soares



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!