Skip to content

Commit 0db91cc

Browse files
authored
chore: Document PlatformDispatcher.onError usage (#1082)
1 parent 5d39473 commit 0db91cc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

flutter/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ It will capture errors in the native layer, including (Java/Kotlin/C/C++ for And
2323

2424
- Initialize the Sentry SDK using the DSN issued by Sentry.io:
2525

26+
- The SDK already runs your init `callback` on an error handler, such as [`runZonedGuarded`](https://api.flutter.dev/flutter/dart-async/runZonedGuarded.html) on Flutter versions prior to `3.3`, or [`PlatformDispatcher.onError`](https://api.flutter.dev/flutter/dart-ui/PlatformDispatcher/onError.html) on Flutter versions 3.3 and higher, so that errors are automatically captured.
27+
2628
```dart
2729
import 'package:flutter/widgets.dart';
2830
import 'package:sentry_flutter/sentry_flutter.dart';
@@ -38,7 +40,7 @@ Future<void> main() async {
3840
}
3941
```
4042

41-
Or, if you want to run your app in your own error zone [runZonedGuarded](https://api.flutter.dev/flutter/dart-async/runZonedGuarded.html):
43+
Prior to Flutter 3.3, if you want to run your app in your own error zone [runZonedGuarded](https://api.flutter.dev/flutter/dart-async/runZonedGuarded.html):
4244

4345
```dart
4446
import 'dart:async';
@@ -122,7 +124,6 @@ Or [try out the Alpha version of the Sentry Dart Plugin](https://github.com/gets
122124

123125
- Use a `try/catch` block.
124126
- Use a `catchError` block for `Futures`, examples on [dart.dev](https://dart.dev/guides/libraries/futures-error-handling).
125-
- The SDK already runs your `callback` on an error handler, e.g. using [runZonedGuarded](https://api.flutter.dev/flutter/dart-async/runZonedGuarded.html), events caught by the `runZonedGuarded` are captured automatically.
126127
- [Flutter-specific errors](https://api.flutter.dev/flutter/foundation/FlutterError/onError.html) are captured automatically.
127128
- [Current Isolate errors](https://api.flutter.dev/flutter/dart-isolate/Isolate/addErrorListener.html) which is the equivalent of a main or UI thread, are captured automatically (Only for non-Web Apps).
128129
- For your own `Isolates`, add an [Error Listener](https://api.flutter.dev/flutter/dart-isolate/Isolate/addErrorListener.html) and call `Sentry.captureException`.

0 commit comments

Comments
 (0)