Is your feature request related to a problem?
The SharedPreferencesStore skeleton class exists in packages/storage_kit/lib/key_value/shared_preferences_store.dart but needs full implementation to provide a concrete KeyValueStore implementation using SharedPreferences for persistent, simple data storage.
Describe the solution you'd like
Implement a fully functional SharedPreferencesStore class that implements the KeyValueStore interface using Flutter's shared_preferences package, providing persistent storage for simple key-value data across app sessions.
What is SharedPreferencesStore and why do we need it?
SharedPreferencesStore is a concrete implementation of KeyValueStore using SharedPreferences, providing simple persistent storage for app preferences and settings.
Why it's important:
- Persistence: Data survives app restarts
- Performance: Fast synchronous access after initialization
- Platform Support: Works on iOS, Android, web, desktop
- Simple Data: Perfect for preferences and settings
- Standard Solution: Industry-standard for simple storage
Common use cases:
- User app preferences
- Theme selection (dark/light mode)
- Language preference
- Onboarding completion flag
- Feature flags
- Simple caching
Required Deliverables
-
SharedPreferencesStore implementation with:
- Initialize SharedPreferences
- Implement all KeyValueStore methods
- Type-safe getters/setters
- Error handling
- Null safety
- Integration with shared_preferences package
- Singleton pattern
- Clear documentation
-
Widgetbook stories (6-8 use cases):
- Store string data
- Store int data
- Store bool data
- Store list data
- Retrieve stored data
- Remove key demo
- Clear all demo
- Storage inspector UI
-
SPDX headers in all source files
Key Implementation Specs
- Implements KeyValueStore interface
- Use shared_preferences package
- Singleton instance: SharedPreferencesStore._()
- Factory constructor: SharedPreferencesStore.instance
- initialize() returns Future
- All methods delegate to SharedPreferences
- Error handling for storage failures
- Null safety with nullable returns
- Type conversions handled internally
Acceptance Criteria
Related Files
packages/storage_kit/lib/key_value/shared_preferences_store.dart (skeleton)
packages/storage_kit/lib/key_value/key_value_store.dart (interface)
widgetbook_kit/lib/stories/storage_kit/shared_preferences_store_story.dart (Widgetbook)
Impact: Primary simple storage solution; used throughout the app
Priority: High
Is your feature request related to a problem?
The
SharedPreferencesStoreskeleton class exists inpackages/storage_kit/lib/key_value/shared_preferences_store.dartbut needs full implementation to provide a concrete KeyValueStore implementation using SharedPreferences for persistent, simple data storage.Describe the solution you'd like
Implement a fully functional
SharedPreferencesStoreclass that implements the KeyValueStore interface using Flutter's shared_preferences package, providing persistent storage for simple key-value data across app sessions.What is SharedPreferencesStore and why do we need it?
SharedPreferencesStore is a concrete implementation of KeyValueStore using SharedPreferences, providing simple persistent storage for app preferences and settings.
Why it's important:
Common use cases:
Required Deliverables
SharedPreferencesStore implementation with:
Widgetbook stories (6-8 use cases):
SPDX headers in all source files
Key Implementation Specs
Acceptance Criteria
Related Files
packages/storage_kit/lib/key_value/shared_preferences_store.dart(skeleton)packages/storage_kit/lib/key_value/key_value_store.dart(interface)widgetbook_kit/lib/stories/storage_kit/shared_preferences_store_story.dart(Widgetbook)Impact: Primary simple storage solution; used throughout the app
Priority: High