title: Flutter error : An expression whose value can be 'null' must be null-checked before it can be dereferenced
body: <p>I want to Open Drawer in flutter and used Scaffold key and was working before but after the flutter upgrade, I am getting this error:</p>
  <pre><code>An expression whose value can be 'null' must be null-checked before it can be dereferenced.
  Try checking that the value isn't 'null' before dereferencing it.
  </code></pre>
  <p>My code goes like this:</p>
  <p>I declared a Global Scaffold key <code>GlobalKey&lt;ScaffoldState&gt; _scaffoldKey = new GlobalKey();</code>
  then called it by flat button</p>
  <pre><code>FlatButton.icon(
                       label: Text(&quot;filter&quot;,style: style2.copyWith(color:Colors.lightGreenAccent[400],fontWeight: FontWeight.bold),),
                       onPressed: (){
                        _scaffoldKey.currentState.openEndDrawer();
                       },
  ),
  </code></pre>
  <p><a href="https://i.stack.imgur.com/N3rkz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N3rkz.png" alt="enter image description here" /></a></p>