Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter local database storage [closed]

Currently I'm creating a user registration criteria and it have three registration pages. For each completion of user registration page I want to store it in local storage. If the user closes the app before the 3 level of registration, I want to show the entered details of completed pages without api calling.

So which is the best way of storing data locally in flutter like room database, shared preferences etc

like image 253
kapil tk Avatar asked Jun 26 '26 23:06

kapil tk


1 Answers

It depends on the data you want to store. There are several options from relation databases (sqlite) to key-value stores.

The easiest and best performing stores are

  • Hive (NoSQL)
  • ObjectBox (NoSQL)

If you have complex Data to store and want the advantages of relational storage your primary options are

  • Sqflite (a sqlite plugin for Flutter with raw SQL)
  • Drift (previously Moor, is a full-fledged ORM with code/table generation on top of sqlite)

I think that in your case, Hive or ObjectBox would be best, as the data you are storing is quite simple and does not have many relationships. If you want to store relational data, I personally prefer Drift to Sqflite, as Drift has improved a lot recently.

Of course, there are the secure storage and shared preferences, which should only contain very loose and simple data.

like image 135
Jozott Avatar answered Jun 29 '26 22:06

Jozott



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!