Flutter and Sentry.io. How to connect Error Tracking Software

Image for post
Image for post

How to easily track bugs/errors/issues in your Flutter application using Sentry.io, cloud-based error monitoring system? Let’s check it out.

Step 2

Create a new project:

Image for post
Image for post

Step 3

Add sentry dependency from pub.dev to your pubspec.yaml file:

Image for post
Image for post
dependencies:
sentry: ">=3.0.0 <4.0.0"

with import:

import 'package:sentry/sentry.dart';

Step 4

Now you can add a global error tracker to the main function…

Where to find DSN_KEY?

You can find your DSN key in your Sentry’s project settings:

Image for post
Image for post
Image for post
Image for post

… or you can track anything you like:

someOnTapHandler() async {
await sentry.captureException(
exception: 'My own silly exception',
);
...
}

…or add a custom event

await sentry.capture(
event: Event(
level: SeverityLevel.info,
message: "loginHandler",
extra: {'email': _email}),
);

Step 5

Let’s check the sent error in the Sentry.io project’s issue dashboard:

Image for post
Image for post
Image for post
Image for post

Simple and Awesome!

Java, Spring, Node.js, AdonisJs, React.js and Flutter developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store