Hello. I am having a really really weird bug in a project and I was able to replicate into a simpler project. Basically, when changing screen (with maintainState = false) one bloc is still saved.. so I get two instances of the same bloc triggering BlocBuilder twice and considerably slowing down my project!
I'm not even sure if I explained correctly (therefore, mysterious bug!), but here is a sample, and in that sample, when you run, you should tap to change screen and tap to update the counter.
You should see:
I/flutter (25496): BLOC CHANGED V: 7 INDEX: 1
I/flutter (25496): BLOC CHANGED V: 7 INDEX: 5
Which means both bloc 1 and 5 are awake. I don't know if this is a common bug or etc, but I don't even know what to search. Thanks!
Hi @bernaferrari 馃憢
Thanks for opening an issue!
Are you able to create a gist or github repo instead of a zip? Thanks! 馃憤
I am, but do you really want that? It is almost a one-file project. Everything else is just so you can build it.
yeah if you can just share the one file as a gist it would be great, thanks!
@bernaferrari when you use Navigator.push it does not remove the underlying widget. This is expected behavior and it doesn't have anything to do with the bloc library. If you want to dispose the underlying widget when you push then you can use pushReplacement. Let me know if that helps 馃憤
Uh, thanks!

Ok... I thought maintainState = false was supposed to do this. PushReplacement doesn't keep anything, push keeps everything, push with maintainstate = false only keeps the first one. Really tricky.
Most helpful comment
Uh, thanks!

Ok... I thought
maintainState = falsewas supposed to do this. PushReplacement doesn't keep anything, push keeps everything, push with maintainstate = false only keeps the first one. Really tricky.