Sentry SDK for Dart and Flutter

packagebuildpublikespopularitypub points
sentrybuildpub packagelikespopularitypub points

Versions

Versions ^4.0.0 are Prereleases and are under improvements/testing.

The current stable version is the Dart SDK, 3.0.1.

Usage

  • Sign up for a Sentry.io account and get a DSN at http://sentry.io.

  • Follow the installing instructions on pub.dev.

  • The code snippet below reflects the latest Prerelease version.

  • Initialize the Sentry SDK using the DSN issued by Sentry.io:

import 'dart:async';
import 'package:sentry/sentry.dart';

Future<void> main() async {
  await Sentry.init((options) {
    options.dsn = 'https://example@sentry.io/add-your-dsn-here';
    // For better groupping, change the 'example' below with your own App's package.
    options.addInAppInclude('example');
  });

  try {
    aMethodThatMightFail();
  } catch (exception, stackTrace) {
    await Sentry.captureException(
      exception,
      stackTrace: stackTrace,
    );
  }
}

void aMethodThatMightFail() {
  throw null;
}

Flutter SDK Integration

  • Check out the Flutter SDK with the Native integrations (Android/Apple).

Resources

  • Documentation
  • Forum
  • Discord
  • Stack Overflow
  • Twitter Follow

Libraries

sentry
A pure Dart client for Sentry.io crash reporting.