Use the onIdTokenChanged method to listen for changes in the ID token, such as when the token is refreshed or changes due to user sign-in or sign-out.
Method
final user =awaitFirebaseApp.firebaseAuth?.onIdTokenChanged();
Parameters
None
Return
User?: Returns the currently authenticated user. If no user is signed in, it returns null.
This method provides a stream of user authentication state changes, allowing you to respond to changes in the user's ID token, ensuring that your application stays up to date with the user's authentication status.