title: The instance member 'userEmail' can't be accessed in an initializer
body: <p>The above error message is being displayed in my code. Please see below:</p>
  <pre><code>class BottomNaviBar extends StatefulWidget {
    static const String id = 'bottom_navi_bar';
  
    @override
    _BottomNaviBarState createState() =&gt; _BottomNaviBarState();
  }
  
  class _BottomNaviBarState extends State&lt;BottomNaviBar&gt; {
    int selectedIndex = 0;
    bool showRecipeNotificationBadge = false;
    bool showProfileNotificationBadge = false;
    final _auth = FirebaseAuth.instance;
    FirebaseUser loggedInUser;
    String userEmail;
  
    @override
    void initState() {
      super.initState();
      getCurrentUser();
    }
  
    void getCurrentUser() async {
      try {
        final user = await _auth.currentUser();
        if (user != null) {
          loggedInUser = user;
            userEmail = user.email;
        }
      } catch (e) {
        print(e);
      }
    }
  
  
    List&lt;Widget&gt; _widgetOptions = &lt;Widget&gt;[
      RecipeBlog(),
      FavouritesScreen(userEmail: userEmail,), //this is what is causing the error
      ProperHomeScreen(),
      ProfileScreen(),
    ];
  
    ...
  
  </code></pre>
  <p>Its strange, because if I pass an actual user's email address into the <code>FavouritesScreen()</code> as a hard-coded string, the code works perfectly. But it doesn't work otherwise.</p>
  <p>Any ideas?</p>
  <p>UPDATED ON 02/10/20:</p>
  <p>For more context, here's the code for <code>build</code>:</p>
  <pre><code>  @override
    Widget build(BuildContext context) {
  
      List&lt;Widget&gt; _widgetOptions() {
        return [
          RecipeBlog(),
          FavouritesScreen(userEmail: userEmail,),
          ProperHomeScreen(),
          ProfileScreen(),
        ];
      }
  
      return Scaffold(
        body: Center(
          child: _widgetOptions.elementAt(selectedIndex),
        ),
        bottomNavigationBar: Theme(
          data: Theme.of(context).copyWith(
            // sets the background color of the `BottomNavigationBar`
            canvasColor: Color(0xFF150A42),
            // sets the active color of the `BottomNavigationBar` if `Brightness` is light
          ),
          child: BottomNavigationBar(
            items: &lt;BottomNavigationBarItem&gt;[
              BottomNavigationBarItem(
                icon: Icon(Icons.search),
                title: Container(),
              ),
  
              BottomNavigationBarItem(
                icon: Icon(Icons.favorite, color: Colors.redAccent,),
                title: Container(),
              ),
              BottomNavigationBarItem(
                icon: Stack(children: &lt;Widget&gt;[
                  Icon(Icons.forum),
                  showRecipeNotificationBadge != false
                      ? Positioned(
                    top: 0.0,
                    right: 0.0,
                    child: Icon(Icons.brightness_1,
                        size: 12.0, color: Color(0x00000000)),
                  )
                      : Positioned(
                    top: 0.0,
                    right: 0.0,
                    child: Icon(Icons.brightness_1,
                        size: 12.0, color: Colors.redAccent),
                  ),
                ]),
                title: Container(),
              ),
              BottomNavigationBarItem(
                icon: Stack(children: &lt;Widget&gt;[
                  Icon(Icons.person),
                  showProfileNotificationBadge != false
                      ? Positioned(
                    top: 0.0,
                    right: 0.0,
                    child: Icon(Icons.brightness_1,
                        size: 12.0, color: Color(0x00000000)),
                  )
                      : Positioned(
                    top: 0.0,
                    right: 0.0,
                    child: Icon(Icons.brightness_1,
                        size: 12.0, color: Colors.redAccent),
                  ),
                ]),
                title: Container(),
              ),
            ],
            currentIndex: selectedIndex,
            selectedItemColor: Color(0xFF150A42),
            backgroundColor: Colors.white,
            unselectedItemColor: Colors.black38,
            onTap: _onItemTapped,
            type: BottomNavigationBarType.fixed,
          ),
        ),
        floatingActionButton: selectedIndex == 0 ? null : FloatingActionButton(
          backgroundColor: Color(0xff02aab0),
          onPressed: () {Navigator.push(
            context,
            MaterialPageRoute(builder: (context) =&gt; BottomNaviBar()),
          );},
          child: Icon(Icons.search),
        ),
      );
    }
  }
  
  </code></pre>