title: How to get the current context in Flutter?
body: <p>I am using a bottom navigation bar. On a certain Event trigger I need to show some alert on the current screen.</p>
  
  <p>This is how I have implemented the bottom navigation bar. I have four tabs.
  Here, I need to change the icon of the 4th tab when <code>_isHomeDetected</code> is true and when the user clicks on the icon, i.e on index 3 I have to show an alert message irrespective of which tab the user is in. How do I do this? </p>
  
  <pre><code>class LandingScreen extends StatefulWidget {
    static Widget bottomNavigationBar;
    ..
  }
  
  class _LandingScreenState extends State&lt;LandingScreen&gt; {
    ...
    StreamSubscription&lt;String&gt; _subscription;
    bool _isHomeDetected = false;
  
    @override
    void initState() {
      ...
      _subscription = server.messages.listen(onData, onError: onError);
    }
    onData(message) {
      setState(() {
        _isHomeDetected = json.decode(message)["isHomeBeacon"];
      });
    }
    ...
    @override
    Widget build(BuildContext context) {
      LandingScreen.bottomNavigationBar = new BottomNavigationBar(
          ....
      );
      return new Scaffold(
        body: _currentPage,
        bottomNavigationBar: LandingScreen.bottomNavigationBar,
      );
    }
  
    _navigateToScreens(int currentIndex) {
      List screens = [
        ..
      ];
      setState((){
  
        if (!_isHomeDetected || currentIndex != 3){
          _currentPage = screens[currentIndex];
        } else {
          Utils.showCupertinoAlert(
              context: context, content: "You wanna log out???");
        }
      });
    }
  }
  </code></pre>