alert method

Future<void> alert(
  1. BuildContext context, {
  2. String title = '',
  3. String description = '',
  4. List<Widget>? actions,
})

Shows an alert dialog with the provided title, description, and actions.

context is the BuildContext to display the dialog. title is the title of the dialog. description is the content of the dialog. actions are the actions to display in the dialog.

Implementation

Future<void> alert(
  BuildContext context, {
  String title = '',
  String description = '',
  List<Widget>? actions,
}) async {
  return showDialog<void>(
    context: context,
    barrierDismissible: false, // User must tap button to dismiss.
    builder: (BuildContext context) {
      return AlertDialog(
        title: Text(title),
        content: SingleChildScrollView(
          child: ListBody(
            children: <Widget>[
              Text(description),
            ],
          ),
        ),
        actions: actions,
      );
    },
  );
}