How to remove all routes from the Navigator in Flutter
Remove all routes from the Navigator stack in Flutter, useful for implementing logout functionality.
Filed under
Helpful for designing functionality of a Logout button
Navigator.of(context).pushNamedAndRemoveUntil(
'/desiredNamedRoute',
(Route<dynamic> route) => false,
);