Skip to content

Conversation

@berhili098
Copy link
Contributor

@berhili098 berhili098 commented May 19, 2025

What This PR Does
This PR refactors the internal login service logic, specifically the runProtected() and _retrieveUserInfo() methods, with the goal of:

  • Improving code readability and maintainability

  • Simplifying control flow

  • Making log messages more actionable and less ambiguous

  • Handling broken or missing credentials more gracefully

❓ Why I'm creating this PR
While trying to authenticate using dart pub login, I encountered this issue:
image

you are logged in as null

This indicated broken or malformed credentials, and the current logging flow was not clear or helpful enough.

Simplify the login command logic by retrieving userInfo once at the beginning of the method. This reduces redundancy and improves code readability.
Copy link
Contributor

@sigurdm sigurdm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry - I totally missed out on this PR.

It looks good to me.

We should probably build some kind of tests of this though...

@sigurdm sigurdm merged commit c6695f8 into dart-lang:master Oct 6, 2025
23 checks passed
@sigurdm
Copy link
Contributor

sigurdm commented Oct 6, 2025

Thanks!

@berhili098 berhili098 deleted the refactor/login branch October 6, 2025 13:15
@berhili098 berhili098 restored the refactor/login branch October 6, 2025 13:15
@berhili098 berhili098 deleted the refactor/login branch October 6, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants