What I'm trying to do
I'm trying to delete user image (by setting photoUrl = null). Here is my code:
final UserUpdateInfo updatedInfo = UserUpdateInfo();
updatedInfo.photoUrl = null;
print(updatedInfo.photoUrl);
final user = await _auth.currentUser();
print('Before update: ${user.photoUrl}');
await user.updateProfile(updatedInfo);
await user.reload();
final newUser = await FirebaseAuth.instance.currentUser();
print('After update: ${newUser.photoUrl}');
Expected Output:
The expected out is to get null from newUser.photoUrl.
Actual Output
I/flutter (10813): null
I/flutter (10813): Before update: test20, https://firebasestorage.googleapis.com/v0/b/****/o/profileImages%2FIMG_20200129_133820.jpg?alt=media&token=6597dd66-e3b3-4b87-84b4-9000ceea54b4
I/flutter (10813): After update: test20, https://firebasestorage.googleapis.com/v0/b/****/o/profileImages%2FIMG_20200129_133820.jpg?alt=media&token=6597dd66-e3b3-4b87-84b4-9000ceea54b4
Don't know what is the actual issue. The same code works if I'm updating the photoUrl with a new url but doesn't work while setting it to null.
I had the same issue.
You have to set:
{ photoURL: '' }
instead of null. I think it is a bug.
J
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With