I am developing a project in flutter. this project works with api. I offer the option to change the api url from within the program. When the user makes changes in the program, even if the program is opened and closed, I want to read the last change.
I’m new to flutter so I don’t know. I am asking this question for information. For example, I gave the value x to the api variable. Then I gave the y value instead of the x value in the program. Now I want to read every xaman y variable when the program is closed and opened. What is my way to do this?
If I give an example from C#, properties settings file
3
Answers
You can use the shared_preferences package for this.
Slightly shortened example from their own page:
Setting the value:
Reading the value later or after a app restart:
You can use Hive in flutter, Hive greatly outperforms SQLite and SharedPreferences when it comes to writing or deleting.
code example
You can store data in device local storage.There are a lot of methods, you can achieve this thing. Here are couple of most use options you can consider.
Shared Preference Package