You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/platforms/flutter/troubleshooting.mdx
+20-9Lines changed: 20 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -63,21 +63,32 @@ For prior versions, you can work around this by configuring the SDK only to take
63
63
64
64
## Using Flutter multi-view for Web
65
65
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.
68
67
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:
70
70
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`
72
74
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.
final integration = options.integrations.firstWhere(
82
+
(element) => element is WidgetsBindingIntegration);
83
+
options.removeIntegration(integration);
84
+
```
74
85
75
-
### Example app as multi-view
86
+
### Enable multi-view in the example app
76
87
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.
79
90
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.
81
92
82
93
Now you should be able to see 2 instances of the same application side by side, with different ViewIds in the `AppBar`.
0 commit comments