FLUTTER ECOSYSTEM

shared_preferences

Flutter plugin for reading and writing simple key-value pairs. Wraps NSUserDefaults on iOS and SharedPreferences on Android.

Latest version
2.5.5
30-day downloads
6.8M
Likes
10.6K
Pub points
160

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Overview

A Flutter plugin that enables simple persistent storage of key-value pairs across platforms. It abstracts native APIs—NSUserDefaults on iOS and SharedPreferences on Android—providing a unified interface for storing basic data like user preferences, settings, or session tokens. The package supports all major platforms including Web, macOS, Windows, and Linux, making it ideal for lightweight, cross-platform data persistence. Data is stored locally and accessed asynchronously, ensuring performance and reliability in typical app scenarios.

Use cases
  • Storing user preferences
  • Saving app settings
  • Persisting login state
  • Caching small amounts of data
  • Tracking user sessions
Key features
  • Cross-platform compatibility
  • Simple key-value API
  • Asynchronous operations
  • Persistent local storage
  • Supports multiple platforms
Suitable for
  • Lightweight data storage
  • User preference management
  • App configuration
  • State persistence between launches
  • Simple caching needs
Considerations
  • Not suitable for large datasets
  • No query capabilities
  • Data is not encrypted by default
  • Limited to primitive types
  • Not designed for complex data structures
Supported platformsAndroidiOSWebmacOSWindowsLinux

Install package

flutter pub add shared_preferences

Categories

Dependencies

Dependency list 6 items
  • shared_preferences_android^2.3.4
  • shared_preferences_foundation^2.5.0
  • shared_preferences_linux^2.4.0
  • shared_preferences_platform_interface^2.4.0
  • shared_preferences_web^2.4.0
  • shared_preferences_windows^2.4.0

Source repository

Related projects

Rankings