native_storage
0.4.0, released a year ago by celest.dev
Unified API for native key-value storage across platforms
What it does
Provides a simple interface for reading and writing key-value pairs to platform-native storage such as iOS Keychain, Android SharedPreferences, and Windows Registry. It supports synchronous, asynchronous (via isolates), and secure encrypted storage.
AI-written summary of version 0.4.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- Storing non-sensitive data that should persist across app restarts
- Storing sensitive data that needs encryption and isolation from the UI thread
- Need a single API that works on Android, iOS, macOS, Linux, Windows, and Web
- Migrating from platform-specific storage solutions to a unified API
Skip it when
- Using secure storage on Web, as it is only in-memory and not persistent
- Requiring secure storage on Android versions below API 29
- When you need advanced database features like SQL or NoSQL
Strengths
- Cross-platform support with a single API
- Built-in secure encryption for sensitive data
- Asynchronous APIs via isolates to avoid UI blocking
- Supports both local and secure storage variations
Weaknesses
- Web secure storage is in-memory and not persistent
- Requires native setup for secure storage on Android (min API 29)
- No advanced database features (SQL, NoSQL)
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 12
final storage = NativeStorage();
storage.write('key', 'value');
print(storage.read('key'));Alternatives
Packages that do the same job and could replace native_storage.
- shared_preferences
Simple key-value storage without secure encryption, lighter weight
97Compare - flutter_secure_storage
Provides secure storage with platform-specific implementations, but lacks unified API across all platforms
93Compare
Works with
Packages commonly used together with native_storage: ones it builds on, ones built on it, and its own family.
- stack_tracenative_storage depends on itProvides parsing, inspection, and readable formatting of Dart stack traces.
- webnative_storage depends on itLightweight bindings for browser APIs via JS interop
- ffinative_storage depends on itUtilities for working with Foreign Function Interface (FFI) code in Dart.
- loggingnative_storage depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- stream_channelnative_storage depends on itAn abstraction for two-way communication channels based on the Dart Stream class.
- win32native_storage depends on itCall common Windows APIs and COM objects directly from Dart using FFI.
- jninative_storage depends on itProvides Dart/Flutter bindings to call native Java code via JNI.
- xdg_directoriesnative_storage depends on itA Dart package for reading XDG directory configuration information on Linux.