How to define MODE of Shared_Preferences in Flutter

Issue

In Android, we are defining Shared Preferences Mode like

getSharedPreferences(String name, int mode)

MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE

How we can define MODE in shared_preferences flutter?

Solution

SharedPreferences uses MODE_PRIVATE and by now we don’t have the option to change this.

The other options are now deprecated and it is not recommended to use then. See https://developer.android.com/reference/android/content/Context.html#MODE_WORLD_READABLE.

Answered By – Md Shahnawaz

Answer Checked By – Senaida (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *