Skip to content

Commit 407ad91

Browse files
committed
rephrase text and split up in general and example app related part.
1 parent c58f930 commit 407ad91

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

docs/platforms/flutter/troubleshooting.mdx

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,32 @@ For prior versions, you can work around this by configuring the SDK only to take
6363

6464
## Using Flutter multi-view for Web
6565

66-
Multi-view embedding was introduced in Flutter 3.24. A short description of this feature can be found [here on Medium](https://medium.com/flutter/whats-new-in-flutter-3-24-6c040f87d1e4).
67-
A more detailed guide about the usage is available in the [Flutter docs](https://docs.flutter.dev/platform-integration/web/embedding-flutter-web).
66+
Multi-view embedding was introduced in Flutter 3.24. In the [Flutter docs](https://docs.flutter.dev/platform-integration/web/embedding-flutter-web) you will find a detailed guide about the usage of this feature.
6867

69-
Using Sentry in a multi-view application is possible, but there are some limitations. To make the [sentry flutter example app](https://github.com/getsentry/sentry-dart/tree/main/flutter/example) `multi-view` ready, you will need to modify some parts.
68+
Using Sentry in a multi-view application is possible, but there are some limitations.
69+
The following features do not currently support multi-view:
7070

71-
The `SentryWidget` with the `SentryScreenshotWidget` and the `SentryUserInteractionWidget` do not currently support multiple instances, and cannot be used in a `multi-view` application.
71+
- Screenshots via the `SentryScreenshotWidget` (which is part of the `SentryWidget`)
72+
- User interaction integration via the `SentryUserInteractionWidget` (which is part of the `SentryWidget`)
73+
- Window & Device events via the `WidgetsBindingIntegration`
7274

73-
Also note the `NavigatorKey` in the `MaterialApp` widget. This key is a single `GlobalKey` in the `example app` and therefore doesn't support multiple instances. If you rely on this `NavigatorKey` you will need to handle multiple `Keys` and pass them to the appropriate view/instance. For simplicity, we will not use the `NavigatorKey` in the following example.
75+
To prevent the `WidgetsBindingIntegration` from loading by default, you will need to remove the integration.
76+
77+
```dart
78+
// ignore: implementation_imports
79+
import 'package:sentry_flutter/src/integrations/widgets_binding_integration.dart';
80+
...
81+
final integration = options.integrations.firstWhere(
82+
(element) => element is WidgetsBindingIntegration);
83+
options.removeIntegration(integration);
84+
```
7485

75-
### Example app as multi-view
86+
### Enable multi-view in the example app
7687

77-
Modify your `main.dart` and create the `multi_view_app.dart` file next to your `main.dart` and insert the content from the [docs](https://docs.flutter.dev/platform-integration/web/embedding-flutter-web#handling-view-changes-from-dart).
78-
Modify the `index.html`in the `web` directory and add the `flutter_bootstrap.js`.
88+
To make the [sentry flutter example app](https://github.com/getsentry/sentry-dart/tree/main/flutter/example) `multi-view` ready, you will need to modify the `main.dart` and create the `multi_view_app.dart` file next to the `main.dart` and insert the content from the [docs](https://docs.flutter.dev/platform-integration/web/embedding-flutter-web#handling-view-changes-from-dart).
89+
Modify the `index.html`in the `web` directory and add the `flutter_bootstrap.js` file.
7990

80-
The last step is to add `--web-renderer auto` as additional run args.
91+
Also note the `NavigatorKey` in the `MaterialApp` widget. This key is a single `GlobalKey` in the `example app` and therefore doesn't support multiple instances. If you rely on this `NavigatorKey` you will need to handle multiple `Keys` and pass them to the appropriate view/instance. For simplicity, we will not use the `NavigatorKey` in the following example.
8192

8293
Now you should be able to see 2 instances of the same application side by side, with different ViewIds in the `AppBar`.
8394

0 commit comments

Comments
 (0)