title: Flutter showSnackBar called on null
body: <p>I am trying to show a snack bar in a tabbed flutter app as follows:</p>
  
  <pre><code>  var scaffoldKey = new GlobalKey&lt;ScaffoldState&gt;();
      scaffoldKey.currentState
        .showSnackBar(new SnackBar(
          content: new Text("This is a message")
        );
    });
  </code></pre>
  
  <p>But I am getting the error:</p>
  
  <pre><code>NoSuchMethodError: The method 'showSnackBar' was called on null.
  </code></pre>
  
  <p>In the main.dart file I initialize the app as follows:</p>
  
  <pre><code>runApp(new MaterialApp(...));
  </code></pre>
  
  <p>And then the snackBar is being called in home.dart which has a tabbed interface:</p>
  
  <p>Widget build (BuildContext context) => new Scaffold(...);</p>
  
  <p>So I'm a bit confused on which scaffold to call the snackbar on, and how, and also why <code>scaffoldKey.currentState</code> is null.</p>