So I have an app that Pops the current screen once an event happens. The code works fine on iOS and Android. But on the web I get the following error:
Assertion failed:
..\…\widgets\navigator.dart:5083
_history.isNotEmpty
is not true
The debug dialog shows how points the CupertinoTabView of the current tab in the stack. The navigation is to the root page of the Tab view. The tabBuilder
:
(context, index) {
switch (index) {
case 0:
return CupertinoTabView(
navigatorKey: tabOneKey,
builder: (context) {
return tabs[index];
},
);
break;
case 1:
return CupertinoTabView(
navigatorKey: tabTwoKey,
builder: (context) {
return tabs[index];
},
);
break;
case 2:
return CupertinoTabView(
navigatorKey: tabThreeKey,
builder: (context) {
return tabs[index];
},
);
break;
case 3:
return CupertinoTabView(
navigatorKey: tabFourKey,
builder: (context) {
return tabs[index];
},
);
break;
default:
return Container();
}
}
I have tried Wrapping the Navigator.pop()
in WidgetsBinding.instance.addPostFrameCallback
. The same error happens on web. It changes nothing on mobile. What may be causing this error?