[FIXED] Is there a way to make a separate navigation inside a stream builder – Flutter

Issue

Basically I have a streambuilder as my “home” in main.dart that returns AuthGate (another stream builder) if there’s a network connection or a separate screen if there’s no connection. This works most of the time but when I use Navigator.of(context).push or showModalBottomSheet, the Navigator leaves the stream builder so I can’t observe network changes until the screen is popped. I can make a variable inside AuthGate that decides which screen to return instead of automatically returning TabBarView but that seems messy and complicated. Is there a “native” way to keep all the navigation inside a stream builder in Flutter?

Solution

So when you navigate to new page, all of pervious codes went to background (especially navigate) so one solution is show message based on "Not your internet connection" with listing and using a state management package like provider, bloc or …

Answered By – Hossein Asadi

Answer Checked By – Clifford M. (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published