Dart
Pure Dart SDK used by any Dart application like AngularDart, CLI and Server, it enables reporting messages and errors.
Note
For Flutter apps, please refer to the Flutter integration instead.
Get the SDK from pub.dev by adding the following to your pubspec.yaml
:
pubspec.yaml
Copied
dependencies:
sentry: ^8.6.0
Import Sentry
and initialize it:
Copied
import 'package:sentry/sentry.dart';
Future<void> main() async {
await Sentry.init((options) => options.dsn = 'https://examplePublicKey@o0.ingest.sentry.io/0');
}
Capture a test exception:
Copied
import 'package:sentry/sentry.dart';
try {
aMethodThatMightFail();
} catch (exception, stackTrace) {
await Sentry.captureException(
exception,
stackTrace: stackTrace,
);
}
Source code
The Sentry Dart/Flutter SDK can be found on GitHub sentry-dart
.
- Package:
- pub:sentry
- Version:
- 8.6.0
- Repository:
- https://github.com/getsentry/sentry-dart