local_first_shared_preferences
SharedPreferences-backed config storage for the local_first ecosystem. It implements ConfigKeyValueStorage using the platform shared_preferences plugin and respects namespaces by prefixing keys.
| Supported type | Example |
|---|---|
bool |
true |
int |
42 |
double |
3.14 |
String |
'hello' |
List<String> |
['a', 'b'] |
Usage
final storage = SharedPreferencesConfigStorage(namespace: 'user_alice');
await storage.initialize();
await storage.setConfigValue('theme', 'dark');
final theme = await storage.getConfigValue<String>('theme');
Switching namespaces simply changes the key prefix:
await storage.useNamespace('user_bob');
Example app
This package ships the same demo app as the other local_first storage adapters. To run it:
cd local_first_shared_preferences/example
flutter run
The app uses SharedPreferencesConfigStorage for config metadata, while the rest of the data stack mirrors the main examples.
Contributing
Please read the contribution guidelines in the root project before opening issues or PRs: see ../CONTRIBUTING.md.