title: Flutter Widget Testing of a delayed alert dialog
body: <p>How do I test the dialog as shown in this demo widget? I have tried <code>runAsync</code> and <code>pumpAndSettle</code> but cannot detect the dialog. I know it works and I know this is an unorthodox code but I have my reasons for wanting it this way.</p>
  <pre><code>class TestWig extends StatelessWidget {
  @override
    Widget build(BuildContext context) {
      Future.delayed(Duration.zero, (() =&gt; AlertDialog(title: Text('Hi Dialog'),)));
      return Text('Hi Test');
    }
  }
  </code></pre>
  <p>Things I've tried:</p>
  <pre><code>testWidgets('testing the Future test', (WidgetTester tester) async {
        await tester.runAsync(() async {
          await tester.pumpWidget(MaterialApp(home: TestWig()));
          expect(find.text('Hi Test'), findsOneWidget);
          await tester.pumpAndSettle();
          expect(find.text('Hi Dialog'), findsOneWidget);
        });
      });
  </code></pre>