Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

navigator operation requested with a context that does not include a navigator

final _navKey = GlobalKey<NavigatorState>();

void _navigateToLogin() {
  _navKey.currentState.popUntil((r) => r.isFirst);
  _navKey.currentState.pushReplacementNamed(LoginRoute.name);
}

@override
Widget build(BuildContext context) {
  return MaterialApp(
    navigatorKey: _navKey,
    ...
  );
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #navigator #operation #requested #context #include #navigator
ADD COMMENT
Topic
Name
8+9 =