bugReport static method

void bugReport(
  1. BuildContext context
)

Static method to display the bug report view.

Can be used in an onPressed callback:

onPressed: () {
  BugReportPlugin.bugReport(context);
}

Implementation

static void bugReport(BuildContext context) {
  // Verify that the plugin is configured
  if (_host == null ||
      _collection == null ||
      _apiKey == null ||
      _package == null) {
    showDialog(
      context: context,
      builder: (_) => AlertDialog(
        title: Text(getText('configuration_error_title')),
        content: Text(getText('configuration_error_message')),
        actions: [
          TextButton(
            child: Text(getText('ok_button')),
            onPressed: () => Navigator.of(context).pop(),
          )
        ],
      ),
    );
    return;
  }

  Navigator.of(context).push(
    MaterialPageRoute(
      builder: (context) => const BugReportForm(),
      fullscreenDialog: true,
    ),
  );
}