fix: stop retrying on MissingPluginException from flutter_secure_storage (#200) #209

Merged
guettlibot merged 5 commits from issue-200-fix into main 2026-05-24 06:50:08 +00:00
guettlibot commented 2026-05-24 06:47:01 +00:00 (Migrated from codeberg.org)

Summary

Fixes #200 — sync log repeatedly filled with MissingPluginException(No implementation found for method read on channel plugins.it.nomads.com/flutter_secure_storage).

Root cause: _isPermanentError in both _AccountSync and _JmapAccountSync did not recognise MissingPluginException as a permanent failure. When flutter_secure_storage's platform channel is unavailable (seen on certain Android devices), every call to getPassword() throws this exception. The loop treated it as a transient error and kept retrying with exponential back-off, producing a continuous stream of failures in the sync log.

Fix:

  • Add if (e is MissingPluginException) return true; to _isPermanentError in both sync loop classes (IMAP and JMAP) so the loop stops immediately instead of retrying.
  • Import package:flutter/services.dart show MissingPluginException for the type check.

Test plan

  • Added regression test MissingPluginException from secure storage stops IMAP sync loop permanently in test/unit/account_sync_manager_test.dart
    • Test was written first and confirmed failing before the fix (2 sync log entries after kick)
    • Test passes after the fix (loop stops permanently after 1 failure)
  • All 446 unit + widget tests pass
  • flutter analyze — no issues

🤖 Generated with Claude Code

## Summary Fixes #200 — sync log repeatedly filled with `MissingPluginException(No implementation found for method read on channel plugins.it.nomads.com/flutter_secure_storage)`. **Root cause:** `_isPermanentError` in both `_AccountSync` and `_JmapAccountSync` did not recognise `MissingPluginException` as a permanent failure. When `flutter_secure_storage`'s platform channel is unavailable (seen on certain Android devices), every call to `getPassword()` throws this exception. The loop treated it as a transient error and kept retrying with exponential back-off, producing a continuous stream of failures in the sync log. **Fix:** - Add `if (e is MissingPluginException) return true;` to `_isPermanentError` in both sync loop classes (IMAP and JMAP) so the loop stops immediately instead of retrying. - Import `package:flutter/services.dart show MissingPluginException` for the type check. ## Test plan - [x] Added regression test `MissingPluginException from secure storage stops IMAP sync loop permanently` in `test/unit/account_sync_manager_test.dart` - Test was written first and confirmed **failing** before the fix (2 sync log entries after kick) - Test passes after the fix (loop stops permanently after 1 failure) - [x] All 446 unit + widget tests pass - [x] `flutter analyze` — no issues 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.