Description
I am listening to authstate changes using the listenToUserChanges() function and performing google sign in using the createGoogleAuthCustomer() function, in normal rendered I am able to listen to the FirebaseAuth.instance.authStateChanges() when I perform the google sign in a popup, in wasm even though I continue with google sign in the popup not able to listen to the FirebaseAuth.instance.authStateChanges() and also not able to find the error
import 'package:firebase_auth/firebase_auth.dart';
Stream<User?> listenToUserChanges() async* {
await for (var user in FirebaseAuth.instance.authStateChanges()) {
yield user;
}
}
Future createGoogleAuthCustomer() async {
try {
GoogleAuthProvider googleProvider = GoogleAuthProvider();
// googleProvider
// .addScope('https://www.googleapis.com/auth/contacts.readonly');
// googleProvider.setCustomParameters({'login_hint': '[email protected]'});
return await FirebaseAuth.instance.signInWithPopup(googleProvider);
} catch (e) {
throw CustomException(AuthDataRepository, "Authentication failed",
displayMessage: "Failed to authenticate with Google.");
}
}
Flutter Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.0, on macOS 15.3.1 24D70 darwin-x64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.97.2)
[✓] Connected device (2 available)
[✓] Network resources
• No issues found!
pubspec.yaml
firebase_core: ^3.12.1
firebase_auth: ^5.5.1