SentryClient constructor

SentryClient(
  1. SentryOptions options
)

Instantiates a client using SentryOptions

Implementation

factory SentryClient(SentryOptions options) {
  if (options.sendClientReports) {
    options.recorder = ClientReportRecorder(options.clock);
  }
  RateLimiter? rateLimiter;
  if (options.transport is NoOpTransport) {
    rateLimiter = RateLimiter(options);
    options.transport = HttpTransport(options, rateLimiter);
  }
  // rateLimiter is null if FileSystemTransport is active since Native SDKs take care of rate limiting
  options.transport = ClientReportTransport(
    rateLimiter,
    options,
    options.transport,
  );
  // TODO: Web might change soon to use the JS SDK so we can remove it here later on
  final enableFlutterSpotlight = (options.spotlight.enabled &&
      (options.platformChecker.isWeb ||
          options.platformChecker.platform.isLinux ||
          options.platformChecker.platform.isWindows));
  // Spotlight in the Flutter layer is only enabled for Web, Linux and Windows
  // Other platforms use spotlight through their native SDKs
  if (enableFlutterSpotlight) {
    options.transport = SpotlightHttpTransport(options, options.transport);
  }
  return SentryClient._(options);
}