Home > Mobile >  Flutter, Shared Preferences: Where are the shared preferences stored on the device?
Flutter, Shared Preferences: Where are the shared preferences stored on the device?

Time:01-04

I use the internal shared preferences to store key/values on an Android device. I wanted to have a look at this data directly using a file explorer but I cannot find where it is stored physically. Most apps have an own directory on Android/data but there is no folder for my Flutter app.

Do you have an idea where the data is stored locally?

Thanks in advance.

Edit (To make my problem clearer):

I need to access this data from outside app. A user of my app is not able to start the app anymore for some reasons. I want him to send me the internal data for debugging purposes.

So is it possible to fetch the related files in any way without the app self?

CodePudding user response:

On native android its stored inside the data folder. The path will be something like

/data/data/<your_package_name>/shared_prefs/YOUR_PACKAGE_NAME_preferences.xml

On Flutter projects its stored inside the same folder but with fixed name FlutterSharedPreferences.xml Something like

/data/data/<your_package_name>/shared_prefs/FlutterSharedPreferences.xml

CodePudding user response:

SharedPreferences are stored in an xml file in the app data folder, i.e.

/data/data/YOUR_PACKAGE_NAME/shared_prefs/

You can access these from Device File Explorer Tab inside the Android Studio IDE on the right side : enter image description here

  • Related