getCatcherConfig static method

Map<String, CatcherOptions> getCatcherConfig({
  1. String? sentryDSN,
})

Get the configurations for Catcher

This functions returns the configuration for debug, release and profile. This function sets SilentReportMode() and ConsoleHandler() in all configurations.

Set sentryDSN to configure the SentryHandler() in release configuration

Implementation

static Map<String, CatcherOptions> getCatcherConfig({
  String? sentryDSN,
}) {
  final SentryClient? _sentry =
      sentryDSN != null ? SentryClient(SentryOptions(dsn: sentryDSN)) : null;
  CatcherOptions debugOptions =
      CatcherOptions(SilentReportMode(), [ConsoleHandler()]);
  CatcherOptions releaseOptions = CatcherOptions(
      SilentReportMode(),
      _sentry == null
          ? [ConsoleHandler()]
          : [
              ConsoleHandler(),
              SentryHandler(_sentry),
            ]);
  CatcherOptions profileOptions =
      CatcherOptions(SilentReportMode(), [ConsoleHandler()]);
  return {
    CatcherConfig.DEBUG: debugOptions,
    CatcherConfig.RELEASE: releaseOptions,
    CatcherConfig.PROFILE: profileOptions,
  };
}