alert function

Future<void> alert(
  1. BuildContext context,
  2. String msg, [
  3. String title = 'Notice'
])

Show an alert dialog.

Implementation

Future<void> alert(
  BuildContext context,
  String msg, [
  String title = 'Notice',
]) async {
  await showDialog(
    context: context,
    builder: (context) => AlertDialog(
      title: Text(title),
      content: Text(msg),
      actions: [
        ElevatedButton(
          onPressed: () {
            Navigator.pop(context);
          },
          child: const Text('OK'),
        ),
      ],
    ),
  );
}