rx_storage
4.0.0, released 4 weeks ago by hoc081098.dev
Reactive key-value storage powered by RxDart
What it does
Provides a reactive key-value storage wrapper for Dart and Flutter using RxDart streams to observe changes. It supports custom storage adapters, encoders, decoders, and in-memory persistence.
AI-written summary of version 4.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to observe specific storage keys as streams in a reactive architecture
- You want an RxDart-powered storage layer in your Dart or Flutter application
Skip it when
- You need multi-key transactions or complex relational SQL features
- You prefer standard Futures and do not use RxDart or streams
Strengths
- Reactive stream support for observing individual keys or all entries
- Built-in in-memory storage adapter
- Customizable encoders and decoders for synchronous and asynchronous operations
Weaknesses
- Queue system excludes multi-key transactions
- Direct adapter changes or changes through other wrappers are not observed
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Requires Dart SDK >=3.0.0 <4.0.0. Add via pub add rx_storage.
import 'package:rx_storage/rx_storage.dart';
Future<void> main() async {
final storage = RxStorage<String, void>(InMemoryStorage<String>());
final subscription = storage
.observe<String>('name', (raw) => raw as String?)
.listen((value) => print('Name: $value'));
try {
await storage.write<String>('name', 'Ada', (value) => value);
} finally {
await subscription.cancel();
await storage.dispose();
}
}Alternatives
Packages that do the same job and could replace rx_storage.
- shared_preferences
If you want the standard, official key-value storage solution for simple preferences without RxDart overhead.
97Compare - sqflite
If you need a relational SQLite database rather than a simple key-value store.
96Compare - flutter_secure_storage
If you need to store sensitive data securely using platform-specific secure hardware storage.
93Compare
Works with
Packages commonly used together with rx_storage: ones it builds on, ones built on it, and its own family.
- stack_tracerx_storage depends on itProvides parsing, inspection, and readable formatting of Dart stack traces.
- rxdart_extrx_storage depends on itExtension methods and classes built on top of RxDart like Single and StateStream.
- disposebagrx_storage depends on itUtility to collect and dispose StreamSubscriptions and Sinks in Dart/Flutter.
- sqlbriteSame familyReactive stream wrapper around sqflite for Flutter.
- rx_shared_preferencesBuilt on rx_storageReactive stream wrapper around SharedPreferences for key-value storage.