beamer
beamer copied to clipboard
Last widget/page is being rebuilt when navigating to different beam location, which results in errors
Describe the bug When navigation to a different beam location, the current page you are on (the location where you are navigating away from) is re-build 1 more time.
Since I put my Bloc Providers in each beam location and I navigate to location B from location A and the current page of location A is rebuilt right before navigating (for some reason this happens). I get a (bloc) provider not found exception.
Beamer version: beamer: ^1.6.1
To Reproduce
- Create multiple beam locations (A, B, C) with different Bloc and bloc providers respectfully in each location.
- Navigate from a beam page called 'homePage' on beam location A to a beam Page called 'logOutPage' beam location B.
- When you navigate to beam location B a red assert screen will be shown that the bloc of type 'Foo' can't be found in the tree, because beam location B has already been loaded, and after that beam Page called 'homePage' of beam location A is rebuilt, and throwing the error when a bloc Builder is reached.
To temp fix this is my code, I do a if(context.watch<Foo?> == null) return SizedBox.shrink();
.
Expected behavior Navigate from beam location A to beam location B without rebuilding the beamPage 'homePage' after beamToNamed is called.
Desktop (please complete the following information):
- Every platform