Advanced Usage
Requirements
For the usage of the Flutter SDK, the minimal required Dart SDK version is 2.8.0
and Flutter SDK version is 1.17.0
Automatic Breadcrumbs
The Flutter SDK already captures breadcrumbs automatically via the Native SDKs.
If you wish to add additional Navigation breadcrumbs for Flutter Apps, Add the SentryNavigationObserver
to your MaterialApp
, WidgetsApp
or CupertinoApp
Copied
import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
MaterialApp(
navigatorObservers: [
SentryNavigatorObserver(),
],
// other parameters
)
To track automatic Breadcrumbs for HTTP
requests, Check out the SentryHttpClient Wrapper for the http library.
Uploading Debug Symbols (Android and iOS)
- iOS dSYM files
- Android NDK, You've to do it manually, Do not use the
uploadNativeSymbols
flag from the Sentry Gradle Plugin, it's not supported yet. - Android Proguard/R8 mapping file
- Source maps for Flutter Web
Known Limitations
- Flutter
split-debug-info
andobfuscate
flags aren't yet supported on iOS; they are supported only on Android. If this feature is enabled, Dart stack traces are not human readable, this is a tooling limitation, See: 43612 and 43274. - If you enable the
split-debug-info
feature, you must upload the Debug Symbols manually. - Also, Issue's titles might be obfuscated as we rely on the
runtimeType
, but they may not be human-readable, See: Obfuscate Caveat
Tips for Catching Errors
- Use a
try/catch
block - Use a
catchError
block forFutures
- The SDK already runs your init
callback
on an error handler, e.g. usingrunZonedGuarded
, are captured automatically - Flutter-specific errors (such as layout failures), e.g. using
FlutterError.onError
, are captured automatically Isolate
errors on thecurrent
Isolate which is the equivalent of a main/UI thread, e.g. usingIsolate.current.addErrorListener
, are captured automatically (Only for non-Web Apps).- For your own
Isolates
, add anErrorListener
and callSentry.captureException
Caveat
Always prefer the SentryFlutter.init(...)
instead of Sentry.init(...)
as it adds the Flutter integrations on top of the Dart SDK.
Advanced Usage (Android and iOS)
Dart environment variables
- You can configure the
SENTRY_DSN
,SENTRY_RELEASE
,SENTRY_DIST
andSENTRY_ENVIRONMENT
via the Dart environment variables passing the--dart-define
flag to the compiler.
You can edit this page on GitHub.