I already read countless links like this one but it does not help.
The use case is very simple, I want to run a function AFTER the alert box has been dismissed.
void dummyFunc()  {
            sleep(Duration(seconds:3));
            print("done");
}
Future<bool> displayDialog() async {
            return showDialog<bool>(
                context: context,
                barrierDismissible: false, // user must tap button!
                builder: (BuildContext context) {
                    return AlertDialog(
                        title: Text('AlertDialog Title'),
                        content: SingleChildScrollView(
                            child: ListBody(
                                children: <Widget>[
                                    Text('This is a demo alert dialog.'),
                                    Text('Would you like to approve of this message?'),
                                ],
                            ),
                        ),
                        actions: <Widget>[
                            FlatButton(
                                child: Text('Decline'),
                                onPressed: () {
                                    Navigator.of(context).pop(false);
                                },
                            ),
                            FlatButton(
                                child: Text('Approve'),
                                onPressed: () {
                                    Navigator.of(context).pop(true);
                                },
                            ),
                        ],
                        elevation: 24.0,
                        shape:RoundedRectangleBorder(),
                    );
                },
            );
        }
var button = AnimatedOpacity(
            opacity: 1.0,
            duration: Duration(milliseconds: 500),
            child: FloatingActionButton(
                tooltip: 'Start',
                child: Icon(iconShape),
                onPressed: () async {
                    bool shouldUpdate = await displayDialog();
                    print(shouldUpdate);
                    if (shouldUpdate)
                          dummyFunc();
                })
        );
But the alert dialog is dismissed 3sd after.
Kindly let me know what I am doing wrong, Thank you~