title: TabBarView: Controller's length property (2) does not match the number of tabs (1) present in TabBar's tabs property
body: <p>Getting the error as in the title. Of course this is a straightforward thing to check, but some weird behaviour happens. I'm creating a TabBarView with either 1 or 2 tabs, depending on argument in constructor (<code>numTabs</code>). Now Flutter asserts even when the length of tabs is clearly 2 - the controller length is determined by this value, but <code>widget.children.length</code> in <code>Tabs.dart</code> thinks it has a length of one. </p>
  
  <p>Then more strange behaviour: when the length of the TabController is hardcoded as 1, then the two switch, I then get the error <code>Controller's length property (1) does not match the number of tabs (2) present in TabBar's tabs property</code>. So now it knows there are two tabs in TabBar. </p>
  
  <p>Edit: It should be noted that it only happens when I pass in <code>numTabs</code> as 2. <code>numTabs = 1</code> works fine and as expected.</p>
  
  <p>Any help will be appreciated. Here is the code (everything inside a stateful widget):</p>
  
  <pre><code>  List&lt;Widget&gt; tabs;
    List&lt;Widget&gt; tabViews ;
  
    @override
    void initState() {
      super.initState();
       tabs = (widget.numTabs == 1) ? List(1) : List(2) ;
       tabViews = (widget.numTabs == 1) ? List(1) : List(2) ;
      _tabController = new TabController(vsync: this, length: tabs.length);
    }
  
   @override
    Widget build(BuildContext context) {
  
    if (widget.numTabs == 1){
        tabs[0] = (new Tab(text: "Update"));
        tabViews[0] = (_someWidget1);
    }else{
      tabs = [new Tab(text: "Post 1"), new Tab(text: "Post 2")];
      tabViews[0] = (_someWidget1);
      tabViews[1] = (_someWidget2);
    }
  
    return TabBarView(
           controller: _tabController,
              children: &lt;Widget&gt;[ Scaffold(
                  appBar: PreferredSize(
                    preferredSize:
                        Size.fromHeight(screenHeight(context, dividedBy: 5)),
                    child: AppBar(
                      flexibleSpace: FlexibleSpaceBar(
                        title: Center(
                              Text('Title'),
                        ),
                      ),
                      bottom: TabBar(
                        controller: _tabController,
                        tabs: tabs,
                      ),
                    ),
                  ),
                  body: new TabBarView(
                    controller: _tabController,
                    children: tabViews,
                  )),
               ],
            );
       }
  </code></pre>