title: How to make Navigator stay on the active route when StreamProvider updates?
body: <p>In the code below I have created a custom Navigator which is a child to a StreamProvider. My problem is that every time a receive a snapshot from Firestore, the StreamProvider resets the Navigator route. How can I keep the current route while still updating the UI with the new values from the stream?</p>
  
  <p>Also, the ListView in the second code block resets the scroll position on updates from the stream. How can I preserve the scroll position, while still updating the UI with new values?</p>
  
  <pre><code>class _HomeState extends State&lt;Home&gt; {
    @override
    initState() {
      super.initState();
    }
  
    int _selectedIndex = 0;
  
    Future&lt;void&gt; _onItemTapped(int index) async {
      setState(() {
        _selectedIndex = index;
        print(index);
      });
    }
  
    @override
    Widget build(BuildContext context) {
      final FixturesPage fixturesPage = new FixturesPage();
      final ProfilePage profilePage = new ProfilePage();
  
      FirebaseUser user = Provider.of&lt;FirebaseUser&gt;(context);
  
      List&lt;Widget&gt; pages = [
        fixturesPage,
        profilePage,
      ];
  
      return MultiProvider(
        providers: [
          StreamProvider&lt;int&gt;.value(
              value: DatabaseService(userId: user.uid).totalPoints),
          StreamProvider&lt;List&lt;Bet&gt;&gt;.value(
              value: BettingService(userId: user.uid).getBetList)
        ],
        child: Scaffold(
          appBar: AppBar(
              elevation: 0.0, backgroundColor: darkShade5, title: AppBarTitle()),
          body: Container(
            decoration: BoxDecoration(
              color: darkShade4,
            ),
            child: pages[_selectedIndex],
          ),
          bottomNavigationBar: Container(
            child: BottomNavigationBar(
              type: BottomNavigationBarType.fixed,
              backgroundColor: darkShade7,
              selectedFontSize: 10,
              unselectedFontSize: 10,
              elevation: 0,
              unselectedIconTheme:
                  IconThemeData(color: Colors.white.withOpacity(0.9)),
              selectedIconTheme: IconThemeData(color: mainColor),
              unselectedLabelStyle: navigationBarStyle.copyWith(
                  color: Colors.white.withOpacity(0.9)),
              selectedLabelStyle: navigationBarStyle.copyWith(color: mainColor),
              items: [
                BottomNavigationBarItem(
                    icon: Container(
                      height: 20,
                      width: 20,
                      child: Image(
                        image: AssetImage("lib/images/HomeIcon.png"),
                        color: _selectedIndex == 0
                            ? mainColor
                            : Colors.white.withOpacity(0.9),
                      ),
                    ),
                    title: SizedBox()),
                BottomNavigationBarItem(
                    icon: Container(
                      height: 20,
                      width: 20,
                      child: Image(
                        image: AssetImage("lib/images/ProfileIcon.png"),
                        color: _selectedIndex == 1
                            ? mainColor
                            : Colors.white.withOpacity(0.9),
                      ),
                    ),
                    title: SizedBox()),
              ],
              currentIndex: _selectedIndex,
              selectedItemColor: mainColor,
              unselectedItemColor: Colors.white.withOpacity(0.3),
              onTap: _onItemTapped,
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  
  <pre><code>class _FixturesPageState extends State&lt;FixturesPage&gt; {
    int selectedTap = 0;
  
    Function setSelectedTap(int tap) {
      setState(() {
        selectedTap = tap;
      });
  
      return null;
    }
  
    Widget selectedSport = FavoritesTap();
  
    Function setSelectedSport(Widget newSelectedSport) {
      setState(() {
        selectedSport = newSelectedSport;
      });
  
      return null;
    }
  
    ScrollController listViewController =
        ScrollController(keepScrollOffset: true);
  
    @override
    Widget build(BuildContext context) {
      final GlobalKey&lt;NavigatorState&gt; navigatorKey = GlobalKey();
      List&lt;dynamic&gt; matches = Provider.of&lt;List&lt;SoccerMatch&gt;&gt;(context);
  
      return Navigator(
        key: navigatorKey,
        initialRoute: "/",
        onGenerateRoute: (routeSettings) {
          return MaterialPageRoute(
            builder: (context) =&gt; Container(
                color: darkShade6,
                child: Column(
                  children: &lt;Widget&gt;[
                    //CalendarBar(),
                    Expanded(
                      child: ListView(
                        key: PageStorageKey('myListView'),
                        controller: listViewController,
                        children: &lt;Widget&gt;[
                          SizedBox(height: 30),
                          LiveSection(eventList: matches),
                          SizedBox(height: 20),
                          UpcomingSection(eventList: matches),
                          SizedBox(height: 20),
                          ResultsSection(eventList: matches)
                        ],
                      ),
                    )
                  ],
                )),
          );
        },
      );
    }
  }
  
  </code></pre>