title: The getter 'length' was called on null when building a TabBar
body: <p>I'm getting the following error when first loading the TabBar from my Flutter application:</p>
  
  <pre><code>flutter: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
  flutter: The following NoSuchMethodError was thrown building TabBar(dependencies: [_InheritedTheme,
  flutter: _LocalizationsScope-[GlobalKey#c29e1], _TabControllerScope], state: _TabBarState#dd10a):
  flutter: The getter 'length' was called on null.
  flutter: Receiver: null
  flutter: Tried calling: length
  flutter:
  flutter: When the exception was thrown, this was the stack:
  flutter: #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
  flutter: #1      _IndicatorPainter._tabOffsetsEqual 
  package:flutter/…/material/tabs.dart:414
  flutter: #2      _IndicatorPainter.shouldRepaint 
  package:flutter/…/material/tabs.dart:427
  flutter: #3      RenderCustomPaint._didUpdatePainter 
  package:flutter/…/rendering/custom_paint.dart:433
  flutter: #4      RenderCustomPaint.painter= 
  package:flutter/…/rendering/custom_paint.dart:398
  flutter: #5      CustomPaint.updateRenderObject 
  package:flutter/…/widgets/basic.dart:481
  flutter: #6      RenderObjectElement.update 
  package:flutter/…/widgets/framework.dart:4510
  flutter: #7      SingleChildRenderObjectElement.update 
  package:flutter/…/widgets/framework.dart:4881
  (...)
  </code></pre>
  
  <p>It appears to the user and only last few seconds and then everything comes back to the normal and the tab controller works properly. I tried to create my own TabController and I still gets the same error</p>
  
  <p>My code:</p>
  
  <pre><code>class HomeScreen extends StatelessWidget {
    HomeScreen();
  
    @override
    Widget build(BuildContext context) {
  
      return SafeArea(
        child: DefaultTabController(
          length: 5,
          initialIndex: 0,
          child: Scaffold(
            backgroundColor: Color(0xFF25272b),
            appBar: TabBar(
              tabs: [
                Tab(icon: Icon(Icons.home)),
                Tab(icon: Icon(Icons.settings)),
                Tab(icon: Icon(Icons.media)),
                Tab(icon: Icon(Icons.account_box)),
                Tab(icon: Icon(Icons.notifications)),
              ],
            ),
            body: TabBarView(
              physics: NeverScrollableScrollPhysics(),
              children: [
                Content1(),
                Content2(),
                Content3(),
                Content4(),
                Content5(),
              ],
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  
  <p>I tried to comment the content of the TabBar and TabBarView. So I don't think it's a bug that comes from some custom widget I created.</p>
  
  <p>Any ideas on how to solve this?</p>
  
  <p>EDIT: I'm using Redux. I don't know if this may be affecting the problem. Here my main.dart:</p>
  
  <pre><code>class MainAppState extends State&lt;MainApp&gt; {
    Persistor&lt;AppState&gt; persistor;
    Store&lt;AppState&gt; store;
  
    void initState() {
      super.initState();
  
      persistor = Persistor&lt;AppState&gt;(
        storage: FlutterStorage(),
        serializer: JsonSerializer&lt;AppState&gt;(AppState.fromJson),
      );
  
      store = Store&lt;AppState&gt;(
        appReducer,
        initialState: AppState(),
        middleware  : createStoreMiddleware(
          widget.navigatorKey,
        )
        ..add(persistor.createMiddleware()),
      );
  
      persistor.load()
        .whenComplete(() =&gt; store.dispatch(InitAuth()) );
    }
  
    @override
    Widget build(BuildContext context) {
  
      return StoreProvider(
        store: store,
        child: MaterialApp(
          locale: Locale('en'),
          debugShowCheckedModeBanner: false,
          title: 'app',  
          theme: AppTheme.theme,
          navigatorKey: widget.navigatorKey,
          initialRoute: store.state.user == null
            ? LoginScreen.route
            : HomeScreen.route,
          routes: &lt;String, WidgetBuilder&gt; {
            HomeScreen.route  : (context) {
              return StoreBuilder&lt;AppState&gt;(
                builder: (context, store) {
                  return HomeScreen();
                },
              );
            },
  </code></pre>