|
1 |
| -# sentry_flutter_example |
| 1 | +<p align="center"> |
| 2 | + <a href="https://sentry.io" target="_blank" align="center"> |
| 3 | + <img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280"> |
| 4 | + </a> |
| 5 | + <br/> |
| 6 | +</p> |
2 | 7 |
|
3 |
| -Demonstrates how to use the sentry_flutter plugin. |
| 8 | +Sentry Example for Flutter |
| 9 | +=========== |
4 | 10 |
|
5 |
| -## Getting Started |
| 11 | +This is a Flutter app that crashes intentionally in various ways. It demonstrates |
| 12 | +how to capture errors and report them to [sentry.io](https://sentry.io/). |
6 | 13 |
|
7 |
| -This project is a starting point for a Flutter application. |
| 14 | +# Running this sample |
8 | 15 |
|
9 |
| -A few resources to get you started if this is your first Flutter project: |
| 16 | +> First modify the `main.dart` and add your own DSN. You can get one at |
| 17 | +> [sentry.io](https://sentry.io/). This will make sure you can see the result of |
| 18 | +> running this app by looking at what this creates in Sentry. |
10 | 19 |
|
11 |
| -- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) |
12 |
| -- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) |
| 20 | +You need to install [Flutter](https://flutter.dev/docs/get-started/install) in |
| 21 | +order to run this sample. Once you have Flutter installed you can run it via |
| 22 | +`flutter run`. |
13 | 23 |
|
14 |
| -For help getting started with Flutter, view our |
15 |
| -[online documentation](https://flutter.dev/docs), which offers tutorials, |
16 |
| -samples, guidance on mobile development, and a full API reference. |
| 24 | +You should see something like this: |
| 25 | + |
| 26 | +<img src="img/ios_simulator.png" /> |
| 27 | + |
| 28 | +If you click in order on `Open another scaffold`, `Dart: web request` and |
| 29 | +`Dart: try catch`, you should see the following image on |
| 30 | +[sentry.io](https://sentry.io/). |
| 31 | + |
| 32 | +Note the event shows only the application frames by default. You can click |
| 33 | +on the `Full` button to see the complete stack trace. There's also a list of breadcrumbs for |
| 34 | +that exception. In order to get HTTP and navigational breadcrumbs you need to |
| 35 | +use |
| 36 | +[`SentryHttpClient`](https://docs.sentry.io/platforms/dart/usage/advanced-usage/#automatic-breadcrumbs) |
| 37 | +and the |
| 38 | +[`SentryNavigatorObserver`](https://docs.sentry.io/platforms/flutter/enriching-events/breadcrumbs/#automatic-breadcrumbs). |
| 39 | + |
| 40 | +<img src="img/sentry_dashboard.png" /> |
0 commit comments