Skip to content
pubscout

shared_preferences_android

2.5.5, released 9 days ago by flutter.dev

Android backend for the shared_preferences plugin, storing key‑value data on Android devices.

WASM-ready
$ flutter pub add shared_preferences_android
Source repository

What it does

It implements the shared_preferences API for Android, allowing data to be saved using either the native Android SharedPreferences or the newer DataStore Preferences. The package is endorsed and automatically included when using shared_preferences.

AI-written summary of version 2.5.4, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need persistent key‑value storage on Android via shared_preferences
  • You want to use SharedPreferencesAsync or SharedPreferencesWithCache with Android‑specific options

Skip it when

  • You need cross‑platform storage without adding platform‑specific code
  • You require encrypted or secure storage

Strengths

  • Official endorsed federated plugin
  • Supports both Android SharedPreferences and DataStore backends
  • Zero‑config when using shared_preferences

Weaknesses

  • Android‑only; no effect on iOS, web, etc.
  • Adds native Kotlin/JNI layer, increasing app size

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
3
const SharedPreferencesAsyncAndroidOptions options = SharedPreferencesAsyncAndroidOptions(
  backend: SharedPreferencesAndroidBackendLibrary.SharedPreferences,
  originalSharedPreferencesOptions: AndroidSharedPreferencesStoreOptions(
    fileName: 'the_name_of_a_file',
  ),
);

Alternatives

Packages that do the same job and could replace shared_preferences_android.

Works with

Packages commonly used together with shared_preferences_android: ones it builds on, ones built on it, and its own family.