Closed RaduGrama closed 2 years ago
what problem are you trying to solve?
I use Redux for state management and I have epics that handle certain Redux actions, where a context is not available. When I initialize each epic, I pass in the global navigatorKey
and then from epics I can call navigatorKey.currentState.push()
to push a new screen.
I think I answered my own question by using code like:
final router = GoRouter(routes: [ /* routes */ ]);
final navigatorKey = router.routerDelegate.navigatorKey;
// original code
And did that do the trick?
Is there a
navigatorKey.currentState.push()
equivalent in go_router for scenarios where navigation is triggered from Redux middleware for example? WithnavigatorKey
defined asfinal navigatorKey = GlobalKey<NavigatorState>();