I am making Notes App using Flutter which has 2 screens one is the view card screen and the other is home screen.
I want the notes to be stored locally on storage and enable read-write to perform operations. Right now I have the option to create note and save it in some variable (which is reset to no notes when the app is reopened after the exit). If anyone knows this answer, please help me out.
Thank you.
I tried to find out ways of solving this problem but couldn’t get exact solution to my problem.
2
Answers
You can user SharedPreference for store data as locally.
1.First you should add SharedPreference dependency. follow bellow steps for do it.
Or you can install it by you’r terminal go to you flutter proejct and open terminal and copy
flutter pub add shared_preferences
and put it you’r terminal. if you’r done correctly you can see it cheking you’r pubspec.ymal file like bellow.Look at the line number 51. don’t care other’s
2.Now you can use sharedpreference in you’r proect. look at bellow code segment.
It is Simple, just follow the steps
First, import the dependency Shared preferences form
https://pub.dev/packages/shared_preferences
and check the details about itNow, you can use the shared_preferences package to store and retrieve data. Here’s an example: