Reactive Shared Preferences
A Flutter package that provides a reactive wrapper for SharedPreferences.
It allows you to watch keys as streams, so multiple widgets or BLoCs
can react to changes automatically.
Features
- Supports
int,double,bool,String,List<String>. - Streams emit current value immediately and subsequent changes.
- Automatic updates across multiple listeners.
- Easy to integrate with BLoC, Provider, or StreamBuilder.
Usage
final prefs = ReactiveSharedPreferences();
await prefs.init();
// Listen for changes
prefs.watch<int>('counter').listen((value) {
print('Counter: $value');
});
// Update value
await prefs.set<int>('counter', 1);
// Remove key
await prefs.remove('counter');
// Clear all
await prefs.clear();
Libraries
- Reactive Shared Preferences