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 was able to accomplish this with the following code:
Navigator.of(context)
.pushNamedAndRemoveUntil('/login', (Route route) => false);
The secret here is using a RoutePredicate that always returns false (Route
. In this situation it removes all of the routes except for the new /login
route I pushed.