Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add runZoned sample
  • Loading branch information
filiph committed Aug 29, 2019
commit a1e4eb994ee42016189ab29463abad12ee64d36c
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,21 @@ main() async {

- Use a `try/catch` block, like in the example above.
- Create a `Zone` with an error handler, e.g. using [runZoned][run_zoned].
- In Flutter, use [FlutterError.onError][flutter_error]. For example:

```dart
var sentry = SentryClient(dsn: "https://...");
// Run the whole app in a zone to capture all uncaught errors.
runZoned(
() => runApp(MyApp()),
onError: (Object error, StackTrace stackTrace) {
sentry.captureException(
exception: error,
stackTrace: stackTrace,
);
},
);
```
- For Flutter-specific errors (such as layout failures), use [FlutterError.onError][flutter_error]. For example:

```dart
var sentry = SentryClient(dsn: "https://...");
Expand Down