You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/shared_preferences/shared_preferences/README.md
+19-3Lines changed: 19 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -50,9 +50,25 @@ latest data stored on the native platform regardless of what process was used to
50
50
51
51
### Android platform storage
52
52
53
-
The [SharedPreferences] API uses the native [Android Shared Preferences](https://developer.android.com/reference/android/content/SharedPreferences) tool to store data.
53
+
The [SharedPreferencesAsync] and [SharedPreferencesWithCache] APIs can use [DataStore Preferences](https://developer.android.com/topic/libraries/architecture/datastore) or [Android SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences) to store data.
54
+
In most cases you should use the default option of DataStore Preferences, as it is the platform-recommended preferences storage system.
55
+
However, in some cases you may need to interact with preferences that were written to SharedPreferences by code you don't control.
54
56
55
-
The [SharedPreferencesAsync] and [SharedPreferencesWithCache] APIs use [DataStore Preferences](https://developer.android.com/topic/libraries/architecture/datastore) to store data.
57
+
To use the `Android SharedPreferences` backend, use the `SharedPreferencesAsyncAndroidOptions` when using [SharedPreferencesAsync] on Android.
The [SharedPreferences] API uses the native [Android SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences) tool to store data.
56
72
57
73
## Examples
58
74
Here are small examples that show you how to use the API.
@@ -187,7 +203,7 @@ the new prefix otherwise the old preferences will be inaccessible.
0 commit comments