I want to develop a logout button that will send me to the log in route and remove all other routes from the Navigator
. The documentation doesn\'t seem to explain h
I dont know why no one mentioned the solution using SchedularBindingInstance,A little late to the party though,I think this would be the right way to do it originally answered here
SchedulerBinding.instance.addPostFrameCallback((_) async {
Navigator.of(context).pushNamedAndRemoveUntil(
'/login',
(Route route) => false);
});
The above code removes all the routes and naviagtes to '/login' this also make sures that all the frames are rendered before navigating to new route by scheduling a callback