I am coding a to-do list app in flutter but every time I close the app, all my to-do's are gone, and none of them are stored. How do I stop them from disappearing every time I close the app?
CodePudding user response:
Apps generally store data in temporary storage which destroyed every time yo close the app. in order to save data permanently, you could use sqflite database or shared_preferences database
CodePudding user response:
Use sqlite or files. Please refer documentation on cookbooks for either approach.
https://docs.flutter.dev/cookbook/persistence
Your other option is to use an external database over the internet
CodePudding user response:
To persist your data (todo list) you can either
- store data on the users device
You can do this by using a local databases like sqflite, sqfentity, shared_preferences etc
- or store the data on the server
Using this option you can either spin up your own server or use some quick serverless solutions like supabase or cloud firestore from firebase.
CodePudding user response:
I recommend hive it’s very easy to use and it’s lightweigh.
CodePudding user response:
In addition with all the other propositions, you can try Isar, which is a NoSQL local database that can be used for all platforms: