From 04724d56957b77b8822f14026bd369b3a7cb33cd Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Mon, 29 Apr 2024 10:54:08 +0200 Subject: [PATCH] Update --- .../lib/src/integrations/native_app_start_integration.dart | 5 +++-- flutter/lib/src/navigation/sentry_navigator_observer.dart | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/flutter/lib/src/integrations/native_app_start_integration.dart b/flutter/lib/src/integrations/native_app_start_integration.dart index 55617815e4..70997bc901 100644 --- a/flutter/lib/src/integrations/native_app_start_integration.dart +++ b/flutter/lib/src/integrations/native_app_start_integration.dart @@ -114,9 +114,10 @@ class NativeAppStartIntegration extends Integration { // is not created therefore we need to create a transaction ourselves. // We detect this by checking if the currentRouteName is null. // This is a workaround since there is no api that tells us if - // the navigator observer exists or not. + // the navigator observer exists or not. The currentRouteName is always + // set during a didPush triggered by the navigator observer. if (SentryNavigatorObserver.currentRouteName == null) { - const screenName = 'root /'; + const screenName = SentryNavigatorObserver.rootScreenName; // ignore: invalid_use_of_internal_member final transaction = hub.startTransaction(screenName, SentrySpanOperations.uiLoad, startTimestamp: appStartInfo.start); diff --git a/flutter/lib/src/navigation/sentry_navigator_observer.dart b/flutter/lib/src/navigation/sentry_navigator_observer.dart index aaa4c86889..26a3d597af 100644 --- a/flutter/lib/src/navigation/sentry_navigator_observer.dart +++ b/flutter/lib/src/navigation/sentry_navigator_observer.dart @@ -224,7 +224,7 @@ class SentryNavigatorObserver extends RouteObserver> { } if (name == '/') { - name = 'root /'; + name = rootScreenName; } final transactionContext = SentryTransactionContext( name, @@ -366,6 +366,10 @@ class SentryNavigatorObserver extends RouteObserver> { _completedDisplayTracking = Completer(); _timeToDisplayTracker?.clear(); } + + /// The name of the rootScreen + @internal + static const String rootScreenName = 'root /'; } /// This class makes it easier to record breadcrumbs for events of Flutters