I have my app connecting to a server and there are asynchronous messages that come back through connectanum and dart streams. One of these messages is to remove the user from the group they are active in, which means in response to this message the client app needs to navigate to a previous page and essentially stop the stop the user from navigating inside the group they are currently seeing.
How is this done in flutter? I have read about how to use GlobalKey<NavigationState> to remove the need for context, so I used this page to make a NavigationService:
I use getit so I skip the singleton stuff and just have a normal class but basically it gets the GlobalKey<NavigationState> and you set up MaterialApp with navigationKey: _navService.navigationLKey. But when I do this the currentState is null.
Is there a better way to Navigate inside a stream or am I on the right track and just making a mistake somewhere? Thanks for the help.