isOnErrorSupported method

bool isOnErrorSupported(
  1. SentryFlutterOptions options
)

Implementation

bool isOnErrorSupported(SentryFlutterOptions options) {
  try {
    onError;
  } on NoSuchMethodError {
    // This error is expected on pre 3.1 Flutter version
    return false;
  } catch (exception, stacktrace) {
    // This error is neither expected on pre 3.1 nor on >= 3.1 Flutter versions
    options.logger(
      SentryLevel.debug,
      'An unexpected exception was thrown, please create an issue at https://github.com/getsentry/sentry-dart/issues',
      exception: exception,
      stackTrace: stacktrace,
    );
    return false;
  }
  return true;
}