@@ -41,7 +41,10 @@ const String exampleUrl = 'https://jsonplaceholder.typicode.com/todos/';
41
41
const _channel = MethodChannel ('example.flutter.sentry.io' );
42
42
var _isIntegrationTest = false ;
43
43
44
- final GlobalKey <NavigatorState > navigatorKey = GlobalKey <NavigatorState >();
44
+ final GlobalKey <NavigatorState > navigatorKey1 = GlobalKey <NavigatorState >();
45
+ final GlobalKey <NavigatorState > navigatorKey2 = GlobalKey <NavigatorState >();
46
+
47
+ final navigatorKeys = [navigatorKey1, navigatorKey2];
45
48
46
49
Future <void > main () async {
47
50
await setupSentry (
@@ -91,7 +94,7 @@ Future<void> setupSentry(
91
94
92
95
options.maxRequestBodySize = MaxRequestBodySize .always;
93
96
options.maxResponseBodySize = MaxResponseBodySize .always;
94
- options.navigatorKey = navigatorKey ;
97
+ options.navigatorKeys = navigatorKeys ;
95
98
96
99
_isIntegrationTest = isIntegrationTest;
97
100
if (_isIntegrationTest) {
@@ -120,7 +123,7 @@ class _MyAppState extends State<MyApp> {
120
123
create: (_) => ThemeProvider (),
121
124
child: Builder (
122
125
builder: (context) => MaterialApp (
123
- navigatorKey: navigatorKey ,
126
+ navigatorKey: navigatorKeys[ View . of (context).viewId - 1 ] ,
124
127
navigatorObservers: [
125
128
SentryNavigatorObserver (),
126
129
],
0 commit comments