Skip to content

Settings persistence is fire-and-forget across SettingsRepository #886

Description

@TaprootFreak

Observation

Every setter in lib/packages/repository/settings_repository.dart discards the Future<bool> returned by the underlying SharedPreferences write (language, currency, termsAccepted, softwareTermsAccepted, networkMode, and since #885 insiderFeaturesUnlocked). The SettingsBloc handlers call these setters synchronously and emit the new state immediately, so the UI confirms a change before the write is durably flushed. A failed or interrupted disk write is silently ignored; after a restart the app can be in the pre-change state even though the UI confirmed the change.

Assessment

Practical risk is low — SharedPreferences updates its in-memory cache synchronously and flush failures are rare — and the pattern predates #885; the new insider flag merely follows the established convention. Flagged during the #885 review passes as a hardening candidate rather than a merge blocker.

Proposal

Model the repository setters as Future<void> methods, await them in the (then async) bloc handlers before emitting, and surface a failure instead of confirming success. Success feedback in the UI (e.g. SnackBars) should then move to a BlocListener on the emitted transition so it can no longer outrun persistence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions