harden SettingsStore against notify-after-dispose for fire-and-forget writes

set() doesn't await its file write, so a write in flight when the store is
disposed (app shutdown, or a closing test) would assert on a disposed
ChangeNotifier. Skip the post-write notify once disposed via a _disposed guard +
_safeNotify. Surfaced by the T-293 theme-persistence test flaking under the
loaded parallel run; also the correct behaviour for graceful shutdown.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-09 18:05:53 +02:00
co-authored by Claude Opus 4.8
parent 24364e6329
commit adbd8e285a
5 changed files with 62 additions and 5 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ void main() {
});
tearDown(() async {
await pumpEventQueue(); // flush any in-flight unawaited set() file writes
await pumpEventQueue(); // let in-flight writes settle (dispose then no-ops any straggler)
settings.dispose();
theme.dispose();
for (final d in [appTmp, repoTmp]) {