Skip to content

feat(storage-kit): implement SettingsStore for app settings management #118

Description

@husamettinarabaci

Is your feature request related to a problem?

The SettingsStore skeleton class exists in packages/storage_kit/lib/settings/settings_store.dart but needs full implementation to provide a high-level API for app settings management with reactive updates, type-safe access, and default values.

Describe the solution you'd like

Implement a fully functional SettingsStore service that manages app settings using KeyValueStore, provides reactive streams for setting changes, type-safe accessors, default values, and validation.

What is SettingsStore and why do we need it?

SettingsStore is a high-level service for managing app settings with type-safe access, default values, change notifications, and validation, built on top of KeyValueStore.

Why it's important:

  • Type Safety: Strongly-typed settings instead of string keys
  • Defaults: Automatic fallback to default values
  • Reactive: Widgets rebuild when settings change
  • Validation: Ensures valid setting values
  • Centralized: All app settings in one place

Common use cases:

  • Theme mode setting (light/dark/system)
  • Language/locale preference
  • Notification preferences
  • Privacy settings
  • Accessibility settings
  • Feature toggles

Required Deliverables

  1. SettingsStore implementation with:

    • Theme mode getter/setter
    • Locale preference getter/setter
    • Notification enabled getter/setter
    • Custom settings getter/setter
    • Default values
    • Settings change stream
    • Reset to defaults method
    • Integration with KeyValueStore
    • Type-safe API
  2. Widgetbook stories (6-8 use cases):

    • Get theme mode setting
    • Set theme mode setting
    • Get locale setting
    • Set notification preference
    • Settings change stream
    • Reset to defaults
    • Custom settings
    • Settings inspector UI
  3. SPDX headers in all source files

Key Implementation Specs

  • Use KeyValueStore for persistence
  • ThemeMode get themeMode
  • Future setThemeMode(ThemeMode)
  • Locale get locale
  • Future setLocale(Locale)
  • bool get notificationsEnabled
  • Future setNotificationsEnabled(bool)
  • Stream settingsStream
  • resetToDefaults() method
  • Default values as static const
  • Singleton pattern recommended

Acceptance Criteria

  • SettingsStore class implemented
  • themeMode getter/setter
  • locale getter/setter
  • notificationsEnabled getter/setter
  • Custom settings support
  • Default values defined
  • settingsStream emits changes
  • resetToDefaults() works
  • Integration with KeyValueStore
  • Type-safe API
  • Validation on setters
  • All 6-8 Widgetbook stories created and functional
  • SPDX headers present in all files
  • Code follows STYLE_GUIDE.md standards
  • Unit tests cover settings operations

Related Files

  • packages/storage_kit/lib/settings/settings_store.dart (skeleton)
  • packages/storage_kit/lib/key_value/key_value_store.dart (storage backend)
  • widgetbook_kit/lib/stories/storage_kit/settings_store_story.dart (Widgetbook)

Impact: Centralizes app settings; improves settings management UX

Priority: High

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kanban:mobileMobile application development and mobile UI taskstype:featureNew feature or capability

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions