When no password is stored in secure storage for an account, pressing "Try connection" crashed with Bad state: No password stored for account ….
Root cause
_tryConnection() falls back to getPassword() when the password field is empty. getPassword() throws StateError if the key is absent from secure storage, and that exception was unhandled.
Fix
During _load(), try to read the stored password and store the result in _hasStoredPassword. The password field validator now returns "Required" when the field is empty and no password is stored. _tryConnection() already calls _formKey.currentState!.validate() and returns early on failure, so the crash is prevented.
The password field label also changes from "New password (leave blank to keep)" to "Password" when no stored password exists, making the requirement visible to the user.
Test
Added a widget test try connection shows password required when no password stored that taps the Try Connection button without entering a password and asserts a "Required" validation error appears instead of a crash.
When no password is stored in secure storage for an account, pressing "Try connection" crashed with `Bad state: No password stored for account …`.
## Root cause
`_tryConnection()` falls back to `getPassword()` when the password field is empty. `getPassword()` throws `StateError` if the key is absent from secure storage, and that exception was unhandled.
## Fix
During `_load()`, try to read the stored password and store the result in `_hasStoredPassword`. The password field validator now returns "Required" when the field is empty *and* no password is stored. `_tryConnection()` already calls `_formKey.currentState!.validate()` and returns early on failure, so the crash is prevented.
The password field label also changes from "New password (leave blank to keep)" to "Password" when no stored password exists, making the requirement visible to the user.
## Test
Added a widget test `try connection shows password required when no password stored` that taps the Try Connection button without entering a password and asserts a "Required" validation error appears instead of a crash.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
When no password is stored in secure storage for an account, pressing "Try connection" crashed with
Bad state: No password stored for account ….Root cause
_tryConnection()falls back togetPassword()when the password field is empty.getPassword()throwsStateErrorif the key is absent from secure storage, and that exception was unhandled.Fix
During
_load(), try to read the stored password and store the result in_hasStoredPassword. The password field validator now returns "Required" when the field is empty and no password is stored._tryConnection()already calls_formKey.currentState!.validate()and returns early on failure, so the crash is prevented.The password field label also changes from "New password (leave blank to keep)" to "Password" when no stored password exists, making the requirement visible to the user.
Test
Added a widget test
try connection shows password required when no password storedthat taps the Try Connection button without entering a password and asserts a "Required" validation error appears instead of a crash.