title: PageView homepage sometimes does not load on startup in release mode
body: <p>I encountered a rather strange bug when my app is launching in release mode:</p>
  <img src="https://i.imgur.com/A0f1UOp.gif" width="300" />
  <p>I had followed <a href="https://stackoverflow.com/a/64057210/3649364">this</a> answer to preserve my pages for my BottomNavigationBar using <code>PageView</code> and <code>AutomaticKeepAliveClientMixin</code>. In debug mode, this bug does not happen.</p>
  <p><code>home.dart</code></p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:lottery_rewards/controller.dart';
  
  class HomeView extends StatefulWidget {
    const HomeView({Key? key}) : super(key: key);
  
    @override
    State&lt;StatefulWidget&gt; createState() =&gt; _HomeView();
  }
  
  class _HomeView extends State&lt;HomeView&gt;
      with AutomaticKeepAliveClientMixin&lt;HomeView&gt; {
    @override
    Widget build(BuildContext context) {
      super.build(context);
      return Column(
        children: [
          const MainAppBar(),
          Expanded(
            child: Center(
              child: TextButton(
                child: const Text('Home'),
                onPressed: () {
                },
              ),
            ),
          )
        ],
      );
    }
  
    @override
    bool get wantKeepAlive =&gt; true;
  }
  </code></pre>
  <p>Also in the terminal, it says that &quot;Null check operator used on a null value&quot;, however I do not know where I used this code.</p>
  <pre><code>I/flutter (29449): Null check operator used on a null value
  I/flutter (29449): #0      _PagePosition.applyViewportDimension (package:flutter/src/widgets/page_view.dart:455)
  I/flutter (29449): #1      RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1456)
  I/flutter (29449): #2      RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #3      RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #4      RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #5      RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #6      RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #7      RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #8      RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #9      RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #10     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #11     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #12     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #13     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #14     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #15     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #16     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #17     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #18     RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:545)
  I/flutter (29449): #19     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #20     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #21     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #22     _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:318)
  I/flutter (29449): #23     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #24     MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171)
  I/flutter (29449): #25     _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:1003)
  I/flutter (29449): #26     MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240)
  I/flutter (29449): #27     RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:403)
  I/flutter (29449): #28     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #29     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #30     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #31     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #32     _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1376)
  I/flutter (29449): #33     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #34     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #35     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #36     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #37     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #38     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #39     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #40     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #41     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #42     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #43     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #44     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #45     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #46     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #47     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #48     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #49     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #50     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #51     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #52     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #53     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #54     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #55     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #56     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #57     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #58     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #59     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #60     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #61     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #62     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #63     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #64     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #65     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #66     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #67     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #68     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #69     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #70     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #71     RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3462)
  I/flutter (29449): #72     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #73     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #74     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #75     _RenderTheatre.performLayout (package:flutter/src/widgets/overlay.dart:749)
  I/flutter (29449): #76     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #77     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #78     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #79     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #80     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #81     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #82     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #83     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #84     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #85     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #86     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #87     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #88     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #89     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116)
  I/flutter (29449): #90     RenderObject.layout (package:flutter/src/rendering/object.dart:1915)
  I/flutter (29449): #91     RenderView.performLayout (package:flutter/src/rendering/view.dart:165)
  I/flutter (29449): #92     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1757)
  I/flutter (29449): #93     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:887)
  I/flutter (29449): #94     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:504)
  I/flutter (29449): #95     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:892)
  I/flutter (29449): #96     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:370)
  I/flutter (29449): #97     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1146)
  I/flutter (29449): #98     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1083)
  I/flutter (29449): #99     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:997)
  </code></pre>
  <p>Please help! What is causing this issue?</p>