shared_preferences_android 2.4.0 shared_preferences_android: ^2.4.0 copied to clipboard
Android implementation of the shared_preferences plugin
shared_preferences_android #
The Android implementation of shared_preferences
.
Usage #
This package is endorsed, which means you can simply use shared_preferences
normally. This package will be automatically included in your app when you do,
so you do not need to add it to your pubspec.yaml
.
However, if you import
this package to use any of its APIs directly, you
should add it to your pubspec.yaml
as usual.
Options #
The [SharedPreferencesAsync] and [SharedPreferencesWithCache] APIs can use DataStore Preferences or Android SharedPreferences to store data.
To use the Android SharedPreferences
backend, use the SharedPreferencesAsyncAndroidOptions
when using [SharedPreferencesAsync].
const SharedPreferencesAsyncAndroidOptions options =
SharedPreferencesAsyncAndroidOptions(
backend: SharedPreferencesAndroidBackendLibrary.SharedPreferences,
originalSharedPreferencesOptions: AndroidSharedPreferencesStoreOptions(
fileName: 'the_name_of_a_file'));
The [SharedPreferences] API uses the native Android SharedPreferences tool to store data.