reauthenticateWithCredential on EmailAuthProvider with my current email address and password before firebaseUser.updateEmail, but the data returned from reauthenticateWithCredential on iOS has no user and crashes with the following error.Tried calling: []("user")
flutter: 馃挜 #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5)
#1 new AuthResult._ (package:firebase_auth/src/auth_result.dart:12:36)
#2 FirebaseUser.reauthenticateWithCredential (package:firebase_auth/src/firebase_user.dart:214:23)
...
````
## my code
```dart
final baseUser = await _firebaseAuth.currentUser();
// occurs error
final authResult = await baseUser.reauthenticateWithCredential(
EmailAuthProvider.getCredential(
email: baseUser.email,
password: password,
),
);
return authResult.user;
final baseUser = await _firebaseAuth.currentUser();
final firebaseUser = await baseUser.reauthenticateWithCredential(
EmailAuthProvider.getCredential(
email: baseUser.email,
password: password,
),
);
return firebaseUser;
@masashi-sutou
The issue at https://github.com/flutter/flutter/issues/37542 has been closed and moved here. Future collaboration on this issue will be done here.
I am also having this issue, but in my case I called reauthenticateWithCredential for updating the user's password. So thig bug impacts several use cases.
I am on Android and my error is:
D/FirebaseAuth(16156): Notifying id token listeners about user ( xxxxxxxxxxxxxxxxxxxxxxxxxxxx ).
I/flutter (16156): NoSuchMethodError: The method '[]' was called on null.
I/flutter (16156): Receiver: null
I/flutter (16156): Tried calling: []("user")
I think this is the same issue as #76 and will be fixed in #237
@collinjackson I am still getting the NoSuchMethodError: The method '[]' was called on null., even after updating to version 0.15.0 and running pub get.
Make sure you run pub upgrade when changing version numbers...
AFAIK pub upgrade will only be necessary if I don't change the minimum version. Since I changed the minimum version, pub is obligated to respect it and never use a version less than 0.15.0
I thought that originally as well, but pub get doesn't seem to update it even if you change the version. You can verify this by inspecting the pubspec.lock file.
https://github.com/flutter/flutter/issues/44171#issuecomment-553696378
Isn't that only for plugins?
anyway, my pubspec.lock was updated by pub get, I will try a flutter clean.
flutter clean did the trick.
Thanks @feinstein. I included an integration test for the change so it should be working... please let us know if you figure it out.
Most helpful comment
@masashi-sutou
The issue at https://github.com/flutter/flutter/issues/37542 has been closed and moved here. Future collaboration on this issue will be done here.