This package includes a collection of community maintained integrations for Sentry.
import 'package:sentry_plus/sentry_plus.dart';
Future<void> main() {
// also works for SentryFlutter.init
return Sentry.init(
(options) {
options.addSentryPlus();
// other configuration omitted
},
appRunner: () {
// app code
},
);
}
This enables automatic creation of performance traces for most file IO. It includes traces for reading, writing, modifying and deleting files.
This is only available on non-web platforms.
import 'package:sentry_plus/sentry_plus.dart';
Future<void> main() {
// also works for SentryFlutter.init
return Sentry.init(
(options) {
// Add tracing for files
options.addFileTracing();
// other configuration omitted
},
appRunner: () {
// app code
},
);
}
Enable automatic creation of performance traces for HTTP requests for dart:io
platforms.
- This also works for the
http
anddio
packages. - This also captures requests from Flutters
Image.network
widget
This is only available on non-web platforms.
Remarks:
Make sure to disable performance tracing for the http
or dio
packages, if you're using them. Otherwise you're creating two traces for the same request.
import 'package:sentry_plus/sentry_plus.dart';
Future<void> main() {
// also works for SentryFlutter.init
return Sentry.init(
(options) {
// Add tracing for http
options.addHttpTracing();
// other configuration omitted
},
appRunner: () {
// app code
},
);
}
This event processor marks all exceptions caught by Sentry as unhandled: true
. This kinda goes against Sentrys typical usage of it, as unhandled: true
means that the application did a hard crash, which Flutter applications
typically don't do.
import 'package:sentry_plus/sentry_plus.dart';
Future<void> main() {
// also works for SentryFlutter.init
return Sentry.init(
(options) {
options.addEventProcessor(UnhandledEventProcessor());
// other configuration omitted
},
appRunner: () {
// app code
},
);
}
This repo includes some utilities to make it easier to add performance traces
for conversion done by dart:convert
.
import 'package:sentry_plus/sentry_plus.dart';
final List<int> data = [/* ...*/];
// call the extension method `wrapWithTraces()` on a codec or converter
final decoder = utf8.decoder.wrapWithTraces();
final converted = decoder.convert(data);
This code differs from Sentrys design and support philosophy:
- This code doesn't try to be as backwards compatible as possible. This enables this code to make use of newer features.
- This code doesn't try to stay free of dependencies. Low quality dependencies are still not allowed, though.
- This code has no guarantees for API stability
- When comparable features are implemented in (or moved to) Sentry, it will be removed from this package.
- Features & integrations should be easy to integrate and use