flutter_sentry 0.2.1

pub package flutter build code coverage

NOTE: While sentry package provides a low-level functionality to report exceptions from Dart/Flutter code, flutter_sentry plugin (which also uses sentry package behind the scenes!) aims at full integration with Flutter ecosystem, automatically including Flutter application details in reports and catching crashes in native code, including other Flutter plugins and Flutter itself

Setup #

  1. Add flutter_sentry to your pubspec.yaml:

      flutter_sentry: ^0.2.1
  2. Find out a DSN value from Sentry.io and add it to native platforms:

    NOTE: if you forget to add DSN to the platform code, or do it incorrectly, the application will encounter a fatal crash on startup on that platform.

    • iOS: in ios/Runner/Info.plist:

        ... existing configuration parameters ...
        <string>value you got from sentry.io</string>
    • Android: in android/app/src/main/AndroidManifest.xml:

            android:value="value you got from sentry.io" />

      You can also enable debug logging for Sentry Android library if it's not working as intended:

            android:value="true" />

      NOTE: make sure to add <meta-data> tag directly under <application> (and not for example <activity>).

  3. Finally, wrap your runApp() call in FlutterSentry.wrap() like this:

    import 'package:flutter_sentry/flutter_sentry.dart';
    Future<void> main() => FlutterSentry.wrap(
         () async {
           // Optionally other initializers, like Firebase.
         dsn: 'value you got from sentry.io',

Why do I have to specify DSN in multiple places? #

You might be wondering why a DSN value can't be specified in a single place and then exchanged between platforms and Dart/Flutter code via a MethodChannel. The reason for that is, native code and Flutter initialize in parallel, before MethodChannel is available, and if a crash happens before MethodChannel is ready... that part of application is on its own.

That said, we want to minimize the installation burden. While the plugin is still in development, we may eventually introduce a way to configure the value once and have it copied to all platforms at build time. Stay tuned!

0.2.1 #

  • Update README with new flutter_sentry version.
  • Filter package:flutter stack trace frames by default.
  • Remove the use of deprecated method getFlutterEngine.

0.2.0 #

  • Intercept debugPrint() in wrap() and add the message to breadcrumbs for the next event to upload.
  • Enable environment attributes in Dart exceptions.

0.1.0 #

  • Remove pubspec.lock from version control.
  • Add FlutterSentry.breadcrumbs tracker to save a limited number of most recent breadcrumbs, which will be sent to Sentry.io with the next error report.
  • Add FlutterSentryNavigatorObserver allowing to track navigation events in application.
  • Send device information to Sentry.io when reporting an event.

0.0.2 #

  • Add initilize method with dsn to init SentryClient.
  • Make FlutterSentry a Singleton.

0.0.1+2 #

  • Update examples in README.
  • Update plugin description.
  • Add API documentation.

0.0.1+1 #

  • Add badges to README.

0.0.1 #

  • Initial release.


flutter_sentry_example #

Demonstrates how to use the flutter_sentry plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_sentry: ^0.2.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_sentry/flutter_sentry.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 19, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
device_info ^0.4.1 0.4.1+4
flutter 0.0.0
sentry ^3.0.0 3.0.1
Transitive dependencies
async 2.4.0
charcode 1.1.3
collection 1.14.11 1.14.12
http 0.12.0+4
http_parser 3.1.3
meta 1.1.8
path 1.6.4
pedantic 1.9.0
sky_engine 0.0.99
source_span 1.6.0
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
usage 3.4.1
vector_math 2.0.8
Dev dependencies
test ^1.9.4