I am using flutter_bloc
and firebase
for phone auth
.
I am facing this strange behavior where in , When i delete user
account manually, and restart application , Firebase.instance.currentUser
still exists from the previous login!!!!
How to overcome this!
class AuthCubit extends Cubit<AuthState> {
final FirebaseAuth _auth = FirebaseAuth.instance;
// Firebase
AuthCubit() : super(AuthInitialState()) {
User? currentUser = _auth.currentUser;
print("The current user is $currentUser");
print("the current user's uid is : ${currentUser?.uid}");
print("The current user is ${currentUser?.phoneNumber}");
}
This will generate the following output:
I/flutter (11633): The current user is User(displayName: , email: , emailVerified: false, isAnonymous: false, metadata: UserMetadata(creationTime: 2023-01-21 06:10:04.712Z, lastSignInTime: 2023-01-21 06:10:04.713Z), phoneNumber: +919535334951, photoURL: null, providerData, [UserInfo(displayName: , email: , phoneNumber: +91XXXXXXXX, photoURL: null, providerId: phone, uid: )], refreshToken: , tenantId: null, uid: JhSqO5pZsMbp3vgZA6s1WqjKTU63)
I/flutter (11633): the current user's uid is : JhSqO5pZsMbp3vgZA6s1WqjKTU63
I/flutter (11633): The current user is +91XXXXXXXX
My firebase auth section looks like: