title: Correctly trigger Function with key in Flutter
body: <p>So I want to trigger opening a drawer in Flutter</p>
  <p>My site looks like this:</p>
  <pre><code>final GlobalKey&lt;ScaffoldState&gt; _key = GlobalKey(); // Create a key
  
    @override
    Widget build(BuildContext context) {
      return GestureDetector(
        onTap: () =&gt; FocusManager.instance.primaryFocus?.unfocus(),
        child: Scaffold(
          key: _key,
          drawer: HomeDrawer(),
          body: StartAppBar(_key.currentState!.openDrawer),
          bottomNavigationBar: BottomBar(),
        ),
      );
    }
  }
  </code></pre>
  <p>In this line I try to reference the function:</p>
  <pre><code>body: StartAppBar(_key.currentState!.openDrawer),
  </code></pre>
  <p>&amp; in my StartAppBar I wrote:</p>
  <pre><code>class StartAppBar extends StatelessWidget {
      void Function() openDrawer;
      StartAppBar(this.openDrawer);
  </code></pre>
  <p>&amp; on onPressed in the StartAppBar Im trying to call the function</p>
  <pre><code>onPressed: () {
              openDrawer;
            },
  </code></pre>
  <p>But it somehow says that its an unnecessary statement, so I cant open the drawer. What am I doing wrong?</p>