local_value
1.2.0, released 4 years ago by an unverified publisher
An abstraction layer to persist data to the local file system, shared preferences, or secure storage.
What it does
Provides a simple strongly-typed API for saving, reading, and deleting singletons and collections in the local file system, shared preferences, or secure storage. It abstracts underlying packages like path_provider, shared_preferences, and flutter_secure_storage.
AI-written summary of version 1.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want a simple key-value or document-based abstraction over files, shared preferences, and secure storage.
- You need to store user preferences, cached JSON, or singletons like the current user.
Skip it when
- You need complex relational queries, indexing, or ACID transactions provided by a full SQL database.
- You need a robust, web-first local database solution.
Strengths
- Simple and intuitive API with LocalValue and LocalSingleton classes.
- Supports multiple document types including secure storage and shared preferences.
- Fully unit test covered.
Weaknesses
- Relies on underlying plugins for backend implementations.
- Not suitable for complex querying or relational data modeling.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
No special native setup required beyond the dependencies handled by pub.
final localCounterValue = LocalSingleton<int>(id: 'counter_val');
await localCounterValue.write(5);
print(await localCounterValue.read());Alternatives
Packages that do the same job and could replace local_value.
Works with
Packages commonly used together with local_value: ones it builds on, ones built on it, and its own family.
- path_providerlocal_value depends on itProvides Flutter APIs to locate common filesystem directories on Android, iOS, macOS, Linux and Windows.
- shared_preferenceslocal_value depends on itFlutter plugin for reading and writing simple key-value pairs. Wraps NSUserDefaults on iOS and SharedPreferences on Android.
- flutter_secure_storagelocal_value depends on itSecure key-value storage using platform-specific secure mechanisms