title: alert dialog button not working when created with generic dialog flutter
body: <p><a href="https://i.stack.imgur.com/gequv.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>i have created a generic dialog that can create buttons that return some values</p>
  <pre><code>import 'package:flutter/material.dart';
  
  typedef DialogOptionBuilder&lt;T&gt; = Map&lt;String, T?&gt; Function();
  
  Future&lt;T?&gt; showGenericDialog&lt;T&gt;({
    required BuildContext context,
    required String title,
    required String content,
    required DialogOptionBuilder optionBuilder,
  }) {
    final options = optionBuilder();
    return showDialog&lt;T&gt;(
      context: context,
      builder: (context) {
        return AlertDialog(
          title: Text(title),
          content: Text(content),
          actions: options.keys.map((optionTitle) {
            final value = options[optionTitle];
            return TextButton(
              onPressed: () {
                if (value) {
                  Navigator.of(context).pop(value);
                } else {
                  Navigator.of(context).pop();
                }
              },
              child: Text(optionTitle),
            );
          }).toList(),
        );
      },
    );
  }
  </code></pre>
  <p>and when i try to use this generic dialog to create a simple alert dialog that has a button &quot;ok&quot; this &quot;ok&quot; button is not poping out the alert dialog even though i have coded to popout the dialog when no value is returned from the dialog when a button is pressed</p>
  <pre><code>
  Future&lt;void&gt; showCannotShareEmptyNoteDialog(BuildContext context) async {
    return showGenericDialog&lt;void&gt;(
      context: context,
      title: 'Sharing',
      content: &quot;You can't share a empty note&quot;,
      optionBuilder: () =&gt; {
        'OK': null,
      },
    );
  }
  
  </code></pre>
  <p>in here i'm calling the alert dialog</p>
  <pre><code>appBar: AppBar(
          title: const Text(&quot;New Note&quot;),
          actions: [
            IconButton(
              onPressed: () async {
                final text = _textController.text;
                if (_note == null || text.isEmpty) {
                  await showCannotShareEmptyNoteDialog(context);
                } else {
                  Share.share(text);
                }
              },
              icon: const Icon(Icons.share),
            ),
          ],
        ),
  </code></pre>