title: Flutter - Passing Function to StatelessWidget not working
body: <p>I'm trying to make a Generic ConfirmWidget, but it's not working. This is my code:
  My idea is to pass an "Any Function" when my custom widget is invoked.</p>
  
  <pre><code>class ConfirmWidget extends StatelessWidget {
    final BuildContext context;
    final String mensaje;
    final Function btnSi;
  
    ConfirmWidget({this.context, this.mensaje, this.btnSi});
  
    @override
    Widget build(BuildContext context) {
      // TODO: implement build
      return new AlertDialog(
        title: new Text(mensaje),
        actions: &lt;Widget&gt;[
          new FlatButton(
            onPressed: () =&gt; Navigator.of(context).pop(false),
            child: new Text("No"),
          ),
          new FlatButton(
            onPressed: () {
              btnSi == null ? Navigator.of(context).pop(true):btnSi;
            },
            child: new Text("Si"),
          ),
        ],
      );
    }
  }
  
  </code></pre>
  
  <p>My Widget being used:</p>
  
  <pre><code>Future&lt;bool&gt; confirmCancelar(BuildContext context) {
      return showDialog(
        barrierDismissible: false,
        context: context,
        builder: (_) =&gt; new ConfirmWidget(
          mensaje: "¿Está seguro de cancelar la operación?",
          context: context,
          btnSi:()=&gt;Navigator.pop(context),
        ),
      );
    }
  </code></pre>
  
  <p>Any suggestions? thanks in advance.</p>