-
-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migration to usage of PlatformView #2249
Conversation
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- Migration to usage of PlatformView ([#2249](https://github.com/getsentry/sentry-dart/pull/2249)) If none of the above apply, you can opt out of this check by adding |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2249 +/- ##
==========================================
- Coverage 88.35% 88.23% -0.13%
==========================================
Files 247 247
Lines 8578 8635 +57
==========================================
+ Hits 7579 7619 +40
- Misses 999 1016 +17 ☔ View full report in Codecov by Sentry. |
Android Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
64af39c | 386.80 ms | 471.11 ms | 84.31 ms |
0ceb89c | 304.57 ms | 357.18 ms | 52.61 ms |
be08ed1 | 361.37 ms | 414.84 ms | 53.47 ms |
3f23617 | 385.77 ms | 476.10 ms | 90.33 ms |
42f6e7e | 308.71 ms | 360.06 ms | 51.35 ms |
c70e01a | 331.04 ms | 401.46 ms | 70.42 ms |
9d7e862 | 426.35 ms | 510.88 ms | 84.53 ms |
7f75f32 | 347.36 ms | 419.58 ms | 72.22 ms |
86d4841 | 286.35 ms | 372.43 ms | 86.08 ms |
3637a22 | 322.59 ms | 390.00 ms | 67.41 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
64af39c | 6.27 MiB | 7.20 MiB | 958.83 KiB |
0ceb89c | 5.94 MiB | 6.95 MiB | 1.01 MiB |
be08ed1 | 6.33 MiB | 7.26 MiB | 946.42 KiB |
3f23617 | 5.94 MiB | 6.96 MiB | 1.02 MiB |
42f6e7e | 6.27 MiB | 7.20 MiB | 956.06 KiB |
c70e01a | 5.94 MiB | 6.97 MiB | 1.03 MiB |
9d7e862 | 6.33 MiB | 7.26 MiB | 943.41 KiB |
7f75f32 | 6.26 MiB | 7.20 MiB | 959.18 KiB |
86d4841 | 6.15 MiB | 7.13 MiB | 1000.49 KiB |
3637a22 | 6.06 MiB | 7.09 MiB | 1.03 MiB |
Previous results on branch: fix/flutter-multiview-support
Startup times
Revision | Plain | With Sentry | Diff |
---|---|---|---|
2886956 | 453.89 ms | 504.72 ms | 50.83 ms |
e449941 | 404.27 ms | 447.04 ms | 42.77 ms |
7f9b83f | 436.02 ms | 463.04 ms | 27.02 ms |
1b75753 | 471.22 ms | 543.42 ms | 72.20 ms |
6883e29 | 445.52 ms | 484.45 ms | 38.93 ms |
221dadd | 721.34 ms | 773.37 ms | 52.03 ms |
cb75ff1 | 410.88 ms | 469.84 ms | 58.96 ms |
4e69486 | 428.79 ms | 474.69 ms | 45.90 ms |
7d14655 | 419.79 ms | 457.67 ms | 37.88 ms |
1396dfb | 475.13 ms | 511.56 ms | 36.43 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
2886956 | 6.52 MiB | 7.61 MiB | 1.08 MiB |
e449941 | 6.52 MiB | 7.58 MiB | 1.06 MiB |
7f9b83f | 6.52 MiB | 7.61 MiB | 1.08 MiB |
1b75753 | 6.52 MiB | 7.61 MiB | 1.08 MiB |
6883e29 | 6.49 MiB | 7.55 MiB | 1.06 MiB |
221dadd | 6.52 MiB | 7.61 MiB | 1.08 MiB |
cb75ff1 | 6.52 MiB | 7.61 MiB | 1.08 MiB |
4e69486 | 6.52 MiB | 7.61 MiB | 1.08 MiB |
7d14655 | 6.52 MiB | 7.61 MiB | 1.08 MiB |
1396dfb | 6.52 MiB | 7.58 MiB | 1.06 MiB |
iOS Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
8776cdf | 1237.64 ms | 1246.83 ms | 9.20 ms |
f79eecf | 1210.25 ms | 1221.65 ms | 11.40 ms |
abfcdb5 | 1230.87 ms | 1244.94 ms | 14.06 ms |
9d7e862 | 1236.88 ms | 1258.62 ms | 21.74 ms |
7e7f0b1 | 1230.52 ms | 1251.49 ms | 20.97 ms |
3d305b9 | 1230.29 ms | 1247.39 ms | 17.10 ms |
1596141 | 1230.77 ms | 1241.90 ms | 11.13 ms |
d4d0807 | 1246.94 ms | 1260.69 ms | 13.75 ms |
051e97a | 1245.94 ms | 1249.51 ms | 3.57 ms |
d089990 | 1206.19 ms | 1233.08 ms | 26.89 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
8776cdf | 8.33 MiB | 9.40 MiB | 1.07 MiB |
f79eecf | 8.29 MiB | 9.36 MiB | 1.07 MiB |
abfcdb5 | 8.33 MiB | 9.64 MiB | 1.31 MiB |
9d7e862 | 8.32 MiB | 9.38 MiB | 1.05 MiB |
7e7f0b1 | 8.33 MiB | 9.61 MiB | 1.27 MiB |
3d305b9 | 8.33 MiB | 9.63 MiB | 1.29 MiB |
1596141 | 8.29 MiB | 9.37 MiB | 1.08 MiB |
d4d0807 | 8.33 MiB | 9.64 MiB | 1.31 MiB |
051e97a | 8.28 MiB | 9.34 MiB | 1.06 MiB |
d089990 | 8.33 MiB | 9.40 MiB | 1.07 MiB |
Previous results on branch: fix/flutter-multiview-support
Startup times
Revision | Plain | With Sentry | Diff |
---|---|---|---|
2886956 | 1241.90 ms | 1266.65 ms | 24.75 ms |
7f9b83f | 1249.25 ms | 1272.88 ms | 23.63 ms |
7d14655 | 1243.18 ms | 1273.00 ms | 29.82 ms |
4e69486 | 1237.12 ms | 1260.67 ms | 23.55 ms |
1396dfb | 1227.92 ms | 1244.87 ms | 16.95 ms |
221dadd | 1240.65 ms | 1261.70 ms | 21.06 ms |
e449941 | 1229.31 ms | 1239.63 ms | 10.32 ms |
1b75753 | 1245.48 ms | 1270.96 ms | 25.48 ms |
6883e29 | 1236.39 ms | 1277.02 ms | 40.63 ms |
cb75ff1 | 1239.06 ms | 1268.98 ms | 29.92 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
2886956 | 8.38 MiB | 9.73 MiB | 1.35 MiB |
7f9b83f | 8.38 MiB | 9.73 MiB | 1.35 MiB |
7d14655 | 8.38 MiB | 9.73 MiB | 1.35 MiB |
4e69486 | 8.38 MiB | 9.73 MiB | 1.35 MiB |
1396dfb | 8.38 MiB | 9.71 MiB | 1.34 MiB |
221dadd | 8.38 MiB | 9.73 MiB | 1.35 MiB |
e449941 | 8.38 MiB | 9.71 MiB | 1.34 MiB |
1b75753 | 8.38 MiB | 9.73 MiB | 1.35 MiB |
6883e29 | 8.38 MiB | 9.73 MiB | 1.35 MiB |
cb75ff1 | 8.38 MiB | 9.73 MiB | 1.35 MiB |
I am stuck with this console output:
Any ideas how to resolve this? @buenaflor @denrase ps: if you run the example application, don't forget to add |
Ok, on first sight, as we are supporting multiple view, we also need to move to multiple final GlobalKey<NavigatorState> navigatorKey1 = GlobalKey<NavigatorState>();
final GlobalKey<NavigatorState> navigatorKey2 = GlobalKey<NavigatorState>();
final navigatorKeys = [navigatorKey1, navigatorKey2];
final sentryWidgetKey1 = GlobalKey(debugLabel: 'sentry_screenshot_widget_1');
final sentryWidgetKey2 = GlobalKey(debugLabel: 'sentry_screenshot_widget_2');
final sentryWidgetKeys = [sentryWidgetKey1, sentryWidgetKey2];
Future<void> main() async {
await setupSentry(
() => runWidget(
MultiViewApp(
viewBuilder: (BuildContext context) => SentryWidget(
globalKey: sentryWidgetKeys[View.of(context).viewId - 1],
child: DefaultAssetBundle(
bundle: SentryAssetBundle(),
child: const MyApp(),
),
),
),
),
exampleDsn,
);
} At least this is my understanding on the limited exposure i just had to multi-view apps. Wdyt? |
I tried to make the example app run, with your approach, but ran into the problem, that even if we use multiple globalkeys, the The Main.dart currently looks like this: final GlobalKey<NavigatorState> navigatorKey1 = GlobalKey<NavigatorState>();
final GlobalKey<NavigatorState> navigatorKey2 = GlobalKey<NavigatorState>();
final navigatorKeys = [navigatorKey1, navigatorKey2];
final sentryWidgetKey1 = GlobalKey(debugLabel: 'sentry_widget_1');
final sentryWidgetKey2 = GlobalKey(debugLabel: 'sentry_widget_2');
final sentryWidgetKeys = [sentryWidgetKey1, sentryWidgetKey2];
final sentryScreenshotWidgetKey1 =
GlobalKey(debugLabel: 'sentry_screenshot_widget_1');
final sentryScreenshotWidgetKey2 =
GlobalKey(debugLabel: 'sentry_screenshot_widget_2');
final sentryScreenshotWidgetKeys = [
sentryScreenshotWidgetKey1,
sentryScreenshotWidgetKey2
];
Future<void> main() async {
await setupSentry(
() => runWidget(
MultiViewApp(
viewBuilder: (BuildContext context) => SentryWidget(
sentryWidgetGlobalKey: sentryWidgetKeys[View.of(context).viewId - 1],
sentryScreenshotWidgetGlobalKey:
sentryScreenshotWidgetKeys[View.of(context).viewId - 1],
child: DefaultAssetBundle(
bundle: SentryAssetBundle(),
child: const MyApp(),
),
),
),
),
exampleDsn,
);
}
/// This is true when the SentryWidget is in the view hierarchy
bool get _hasSentryScreenshotWidget =>
sentryScreenshotWidgetGlobalKey.currentContext != null; Also final context = sentryWidgetGlobalKey.currentContext; To access the current So we would need to save the |
Also, if you don't use the Using the current main branch, without refactoring to the Future changes should include, the better handling of multiple views and moving away from using single global keys in sentry, which results in problems if you have them multiple times. |
…tsentry/sentry-dart into fix/flutter-multiview-support * 'fix/flutter-multiview-support' of https://github.com/getsentry/sentry-dart: Update CHANGELOG.md release: 8.9.0 chore: rename errorSampleRate to onErrorSampleRate (#2270) fix: repost replay screenshots on android while idle (#2275) feat: capture touch breadcrumbs for all buttons (#2242) Symbolicate Dart stacktrace on Flutter Android and iOS without debug images from native sdks (#2256) Fix: Support allowUrls, denyUrls (#2271) chore(deps): update Flutter SDK (metrics) to v3.24.2 (#2272)
We've decided not to go ahead with this PR as it's too invasive currently to the SDK given the low priority of the new feature (it's not used very much yet) The current plan is to document the limitation of our features in combination with multiview embedding. See getsentry/sentry-docs#11308 If in the future we want to support this fully we will revisit this PR. In that regard, I'm closing this now. |
📜 Description
Fix problems using flutter multiview. At the moment the deprecated SingleFlutterWindows is used which is not compatible with multiview.
Here you find the migration guide
At the moment you need these additional run args to run a Flutter for MultiView App:
--web-renderer auto
💡 Motivation and Context
close #2225
💚 How did you test it?
Adapted the unittest and adapted the example app, supporting two instances of the sample app.
📝 Checklist
sendDefaultPii
is enabled🔮 Next steps