showErrorDialogue method Null safety

void showErrorDialogue(
  1. BuildContext context,
  2. String title,
  3. Exception exception
)

Shows an error dialogue whos body contains information about an Exception.

The only action is to close the dialogue by pressing 'OK'.

Implementation

static void showErrorDialogue(
    BuildContext context, String title, Exception exception) {
  showDialog(
    context: context,
    builder: (BuildContext context) => AlertDialog(
      title: Text(title),
      content: Text((exception as dynamic).message),
      actions: <Widget>[
        TextButton(
          onPressed: () => Navigator.pop(context),
          child: const Text('OK'),
          style: ButtonStyle(
            foregroundColor: MaterialStateProperty.all(Colors.black),
          ),
        ),
      ],
    ),
  );
}