error static method

Future<void> error(
  1. dynamic e, {
  2. String title = 'label_error',
})

Shows an error popup with the provided argument.

Implementation

static Future<void> error(dynamic e, {String title = 'label_error'}) async {
  var message = e is LocalizedExceptionMixin ? e.toMessage() : e.toString();

  await showDialog(
    context: router.context!,
    builder: (context) => AlertDialog(
      title: Text(title.l10n),
      content: Text(message),
      actions: [
        TextButton(
          onPressed: () => Navigator.of(router.context!).pop(),
          child: Text('btn_ok'.l10n),
        ),
      ],
    ),
  );
}