showAlertDialog function

Future<void> showAlertDialog(
  1. BuildContext context, {
  2. required String title,
  3. required String message,
  4. String? confirmLabel,
})

Shows an alert dialog with the given title and message to the user. The dialog will have an OK button to dismiss it.

Implementation

Future<void> showAlertDialog(
  BuildContext context, {
  required String title,
  required String message,
  String? confirmLabel,
}) async {
  await showGenericDialog<void>(
    context,
    title: title,
    content: Text(message),
    actions: [
      PrimaryDialogAction(
        label: confirmLabel ?? 'OK',
        onPressed: Navigator.pop,
      ),
    ],
  );
}