showAlert method

Future<void> showAlert(
  1. String title,
  2. String? message
)

Implementation

Future<void> showAlert(String title, String? message) {
  return showDialog<String>(
    context: _context,
    barrierDismissible:
        false, // dialog is dismissible with a tap on the barrier
    builder: (BuildContext context) {
      return AlertDialog(
        title: Text(title),
        content: Row(
          children: <Widget>[
            Expanded(child: Text(message!)),
          ],
        ),
        actions: <Widget>[
          ElevatedButton(
            child: const Text('Ok'),
            onPressed: () {
              Navigator.of(context).pop();
            },
          ),
        ],
      );
    },
  );
}