-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[firebase_auth] Update auth methods to return AuthResult instead of FirebaseUser #1911
Conversation
AuthResult instead of FirebaseUser.
kroikie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with small readability nit.
| FirebaseUser user = await auth.currentUser(); | ||
| user = await user.linkWithCredential(credential); | ||
| AuthResult result = await user.linkWithCredential(credential); | ||
| user = result.user; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some cases the user is extracted in one statement and in other cases it is extracted in two statements. Maybe it would be more readable to keep it consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. I've updated the tests. In the process I wrote some more tests of the new code I added and fixed some issues (I had missed reauthenticate on my first pass, and the getter for profile lacked an appropriate cast)
…ests and add missing cast
…irebaseUser (flutter#1911) * Sign-in methods now return `AuthResult` instead of `FirebaseUser`. * Change `reauthenticateWithCredential` to return AuthResult as well * Update tests
…irebaseUser (flutter#1911) * Sign-in methods now return `AuthResult` instead of `FirebaseUser`. * Change `reauthenticateWithCredential` to return AuthResult as well * Update tests
Description
This change adds new
AuthResultandAdditionalUserInfoclasses, bringing the API in line with how things work on Android. We don't expose thecredentialon theAuthResultclass (yet).This is a Breaking Change because sign-in methods now return
AuthResultinstead ofFirebaseUser. Pretty much every user of this plugin will have to update their code. We're getting this out of the way prior to 1.0.Related Issues
This change should be landed instead of #1614
Another breaking change that should land at the same time: #1871
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?