Open kjhamja77 opened 1 month ago
It's hard to judge since you didn't show what is on the first screenshot and when in the widget tree you are using it. But my guess would be that you are expecting the widget with BlocListener
and BlocBuilder
(you can combine them using BlocConsumer
btw) to work with the latest state of that bloc/cubit. But that is only true for the BlocBuilder
, not for BlocListener
. BlocListener
works only with state changes, aka you must have the widget attached before the state changes to trigger the listener
.
You already provided cubit for the whole app, in your case, you don't need to provide the same cubit again, as we see per the first screenshot.
Description The Bloc listener is not listening for changes from the Authentication cubit but the Bloc builder got a new state and updated the UI based on the new state emitted from the cubit.
Steps To Reproduce
Expected Behavior I need to navigate to the home page if the user ID is not null, else I need to navigate to the login screen.
Screenshots kindly check the below screenshots
![Screenshot 2024-07-30 130313](https://github.com/user-attachments/assets/cbed7e2d-7f46-472b-bd46-c70097052d3c)