Not all data is created equally — and not all data should be stored the same way. Similar to learning about HashMaps, Linked Lists, Heaps, etc., it’s important to know the different ways to store data in your Flutter App to create the best user experience possible.

For instance, what happens when you don’t need to deserialize a whole object — just a single field or value? It doesn’t make sense grabbing a whole config.json from memory when all you need is a single boolean field, like isDarkMode=false. On the contrary, it doesn’t make sense storing large, single objects in table — If you’re only ever going to have 1 row, what’s the point of designing a whole schema?

For each of the 4 ways I’ll be talking about local data storage, I’ll go over:

  • What niche the storage fills
  • Realistic use cases
  • Examples w/ package recommendations

If you’re about to write a Flutter app, I recommend a bookmark to this page so that you can always refer to it when trying to figure out how to store data.

  • Simple Key Value — Shared Preferences
  • Sensitive Key Value — Secure Storage
  • Highly Structured Tables — Hive / SQLite
  • Large Temporary/Permanent Single Object — Local File Storage

#programming #flutter

The 4 Ways to Store Data Locally in Your Flutter App (That you’re Going to Need)
3.75 GEEK