title: Flutter CupertinoTabBar: cannot switch to a tab by index on a stream event
body: <p>Trying to activate <code>CupertinoTabBar's</code> tab 0 while tab 1 is active on a <code>stream event</code> like this:</p>
  
  <pre><code>{
  
  class HomeScreen extends StatefulWidget {
    @override
    State&lt;StatefulWidget&gt; createState() =&gt; HomeScreenState();
  }
  
  class HomeScreenState extends State&lt;HomeScreen&gt; {
  
    int _currentTabIndex = 0;
  
    @override
    void initState() {
      super.initState();
      _drawerStream.listen((state) {
        if (_currentTabIndex != 0) {
          SchedulerBinding.instance.addPostFrameCallback((_) {
            setState(() =&gt; _currentTabIndex = 0);
          });
        }
      });
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        drawer: Drawer(
          elevation: 0.0,
          child: DrawerScreen(),
        ),
        body: CupertinoTabScaffold(
          tabBar: CupertinoTabBar(
            onTap: (index) {
              _currentTabIndex = index;
            },
            currentIndex: _currentTabIndex,
            backgroundColor: Colors.white,
            items: &lt;BottomNavigationBarItem&gt;[
              BottomNavigationBarItem(
                title: Text('Main'),
                icon: Icon(IconData(0xe800), size: 20),
              ),
              BottomNavigationBarItem(
                title: Text('Goodies'),
                icon: Icon(IconData(0xe84b), size: 20),
              ),
            ],
          ),
          tabBuilder: (BuildContext context, int index) {
            return CupertinoTabView(
              builder: (BuildContext context) {
                switch (index) {
                  case 0: return MainScreen();
                  case 1: return GoodiesScreen();
                }
              },
            );
          },
        ),
      );
    }
  }
  }
  </code></pre>
  
  <p>It nothing happens visually when an event comes from <code>_drawerStream</code>. Still tracing what's going on using the debugger it found that <code>CupertinoTabBar</code> widget builds 2 times and 1st time it has current index parameter 0, what we actually need. But the second run it rebuilds with current index parameter set to 1, which is not what we want. </p>
  
  <p>What the reason for that, how we can switch to a tab on an external event?</p>