title: Flutter build function returns null
body: <p>I am trying to navigate to my home page or login page on the basis of authStatus. While using  Navigator.of(context)... it returns null on the build method for a second and then screen refreshes and navigate to the given page successfully. I am relatively new to mobile development and flutter. Any leads will help! Thanks.</p>
  <p>Here is the code:</p>
  <pre><code>  @override
    Widget build(BuildContext context) {
      switch (authStatus) {
        case AuthStatus.NOT_LOGGED_IN:
          WidgetsBinding.instance.addPostFrameCallback((_) {
            {
              Navigator.push(
                context,
                MaterialPageRoute(
                    builder: (context) =&gt; LoginSignUpPage(
                          auth: widget.auth,
                          onSignedIn: _onLoggedIn,
                          params: widget.params,
                        )),
              );
            }
          });
  
          break;
        case AuthStatus.LOGGED_IN:
          if (_userId.length &gt; 0 &amp;&amp; _userId != null) {
            WidgetsBinding.instance.addPostFrameCallback((_) {
              Navigator.push(
                context,
                MaterialPageRoute(
                    builder: (context) =&gt; HomePage(
                          userId: _userId,
                          auth: widget.auth,
                          onSignedOut: _onSignedOut,
                          params: widget.params,
                        )),
              );
            });
          } else
            return widget.waitingScreen;
          break;
        default:
          return widget.waitingScreen;
      }
  </code></pre>
  <p>Here is the error :</p>
  <p><strong>A build function returned null.
  The offending widget is:
  RootPage
  Build functions must never return null.
  To return an empty space that causes the building widget to fill available room, return
  &quot;Container()&quot;. To return an empty space that takes as little room as possible, return
  &quot;Container(width: 0.0, height: 0.0)&quot;.</strong></p>