In main.dart I've added this:
FirebaseAuth.instance.userChanges().listen((event) async {
debugPrint('user state changed in main');
});
The event is continuously getting triggered, with no changes to the users logged in status (I am developing for the web, not tested on devices).
CodePudding user response:
Use authStateChanges
when interested in the current user.
Notifies about changes to the user's sign-in state (such as sign-in or sign-out).
Notifies about changes to any user updates.
CodePudding user response:
The issue was isolated - I was calling this inside the .listen((event) async {}
token = await FirebaseAuth.instance.currentUser!.getIdTokenResult(true);
which was triggering the event again...