sentry_flutter 8.0.0-beta.2 copy "sentry_flutter: ^8.0.0-beta.2" to clipboard
sentry_flutter: ^8.0.0-beta.2 copied to clipboard

Sentry SDK for Flutter. This package aims to support different Flutter targets by relying on the many platforms supported by Sentry with native SDKs.

Sentry SDK for Flutter #

package build pub likes popularity pub points
sentry_flutter build pub package likes popularity pub points

This package includes support to native crashes through Sentry's native SDKs: (Android and iOS). It will capture errors in the native layer, including (Java/Kotlin/C/C++ for Android and Objective-C/Swift for iOS).


  • Sign up for a account and get a DSN at

  • Follow the installing instructions on

  • Initialize the Sentry SDK using the DSN issued by

  • The SDK already runs your init callback on an error handler, such as runZonedGuarded on Flutter versions prior to 3.3, or PlatformDispatcher.onError on Flutter versions 3.3 and higher, so that errors are automatically captured.

import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<void> main() async {
  await SentryFlutter.init(
    (options) {
      options.dsn = 'https://[email protected]/add-your-dsn-here';
    // Init your App.
    appRunner: () => runApp(MyApp()),

Prior to Flutter 3.3, if you want to run your app in your own error zone runZonedGuarded:

import 'dart:async';

import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<void> main() async {
  runZonedGuarded(() async {
    await SentryFlutter.init(
      (options) {
        options.dsn = 'https://[email protected]/add-your-dsn-here';

  }, (exception, stackTrace) async {
    await Sentry.captureException(exception, stackTrace: stackTrace);
Tracking navigation events

In order to track navigation events you have to add the SentryNavigatorObserver to your MaterialApp, WidgetsApp or CupertinoApp.

You should provide a name to route settings: RouteSettings(name: 'Your Route Name'). The root route name / will be replaced by root "/" for clarity's sake.

import 'package:flutter/material.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

// ...
  navigatorObservers: [
  // other parameters
// ...

For a more throughout example see the example.

Performance tracing for AssetBundles

Sentry has support for tracing AssetBundles. It can be added with the following code:

    bundle: SentryAssetBundle(),
    child: MyApp(),

This adds performance tracing for all AssetBundle usages, where the AssetBundle is accessed with DefaultAssetBundle.of(context). This includes all of Flutters internal access of AssetBundles, like Image.asset for example.

Tracking HTTP events

Please see the instructions here.

Known limitations
  • If you enable the split-debug-info feature, you must upload the Debug Symbols manually.
  • Layout related errors are only caught by FlutterError.onError in debug mode. In release mode, they are removed by the Flutter framework. See Flutter build modes.
Uploading Debug Symbols and Source maps (Android, iOS/macOS and Web)

Debug symbols and Source maps provide information that Sentry displays on the Issue Details page to help you triage an issue. We offer a range of methods to provide Sentry with debug symbols, follow the docs to learn more about it.

Or try out the Alpha version of the Sentry Dart Plugin that does it automatically for you, feedback is welcomed.

Tips for catching errors
  • Use a try/catch block.
  • Use a catchError block for Futures, examples on
  • Flutter-specific errors are captured automatically.
  • Current Isolate errors which is the equivalent of a main or UI thread, are captured automatically (Only for non-Web Apps).
  • For your own Isolates, add an Error Listener by calling isolate.addSentryErrorListener().


  • Flutter docs
  • Dart docs
  • Discussions
  • Discord Chat
  • Stack Overflow
  • Twitter Follow
pub points



Sentry SDK for Flutter. This package aims to support different Flutter targets by relying on the many platforms supported by Sentry with native SDKs.

Repository (GitHub)
View/report issues


API reference




ffi, flutter, flutter_web_plugins, meta, package_info_plus, sentry


Packages that depend on sentry_flutter