title: Autoclose dialog in Flutter
body: <p>I want to autoclose dialog a few seconds after opening. The solution that I found is to call <code>Navigator.of(context).pop();</code> delayed and it works. But the problem occurs if I closed it manually (by clicking outside) before the execution of the Navigator.pop command. Then Navigator.pop just closes the app and I see just a black screen.
  I need a way to destroy this delay on closing the dialog or to find another workaround.</p>
  
  <pre><code>showDialog(
    context: context,
    builder: (BuildContext builderContext) {
      Future.delayed(Duration(seconds: 5), () {
        Navigator.of(context).pop();
      });
  
      return AlertDialog(
        backgroundColor: Colors.red,
        title: Text('Title'),
        content: SingleChildScrollView(
          child: Text('Content'),
        ),
      );
    }
  );
  </code></pre>