New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: BlocConsumer.listener
is not being fired
#4161
Comments
Hi @feinstein 👋 This is happening because the |
Hi @felangel thank you for the clarification. I think this should be added into the docs then. I am adapting Google's recommended Android App Architecture, using bloc at the UI layer. My cubit acts as a View Model, making the decisions for the UI. Once the decision to navigate is made, the cubit emits a new state with a flag, so my View, in Flutter, can navigate (using a listener). In this code, I want to navigate as soon as I get the result on load, but I understand now this won't be possible using bloc, unless I do some hacks :/. Do you think it's worthy to make the |
I highly recommend checking out something like |
I am using navigation 2.0 with the go_router already, I will explore more your suggestion, thanks. |
Sounds good! You can refer to the Firebase Login Example for a reference. |
When my UI first loads and 2 different states have been emitted, the
listener
callback is not being fired. If I add aFuture.delayed
between the emissions, it fires correctly though.Please see the example code (you need to add
freezed
and run thebuild_runner
):The text was updated successfully, but these errors were encountered: