title: onWillPop - Future<bool>Function(BuildContext) can not be assigned to parameter type Future<bool>Function()
body: <p>Please help me in solving this error in my flutter application:</p>
  
  <pre><code>    class MyApp extends StatelessWidget {
  
        Future&lt;bool&gt; _onBackPressed(BuildContext context) {
  
          return showDialog(
              context:context,builder:(BuildContext context)=&gt;AlertDialog(title: Text('Exit'),
            actions: &lt;Widget&gt;[
              FlatButton( child:Text('NO'),onPressed: ()=&gt;Navigator.pop(context,false)),
              FlatButton( child:Text('Yes'),onPressed: ()=&gt;Navigator.pop(context,true))
  
  
            ],));
  
        }
        @override
        Widget build(BuildContext context) {
          return WillPopScope(onWillPop:_onBackPressed, // **the argument type Future&lt;bool&gt;Function(BuildContext) can not be assigned to parameter  Future&lt;bool&gt;Function()**
  
          child: MaterialApp(
          debugShowCheckedModeBanner: false,
          title: 'ListViews',
          theme: ThemeData(
          primarySwatch: Colors.teal,
          ),
          home: Scaffold(
          appBar: AppBar(title: Text('ListViews')),
          body: BodyLayout(),
          ),
          ));
        }
      }
  </code></pre>
  
  <ol>
  <li>How can I correct this error ?</li>
  <li>After writing  <code>Future&lt;bool&gt;_onBackPressed(BuildContext context) async{</code>  this error appears in the error box </li>
  </ol>
  
  <p><strong>Error</strong>:</p>
  
  <pre><code>the argument type Future&lt;bool&gt;Function(BuildContext) can not be assigned to parameter  Future&lt;bool&gt;Function()
  </code></pre>
  
  <p>Please mention if you know any better way to add <strong>ON DOUBLE PRESS EXIT FLUTTER APP</strong></p>