toAndReplaceAllNamedRoute method
Navigates to a new route, replacing all previous routes in stack.
If a valid BuildContext is provided, this method navigates to the specified named route, replacing all previous routes in the navigation stack.
Implementation
void toAndReplaceAllNamedRoute({String? routeName, Map<String,dynamic>? args}) {
Navigator.pushNamedAndRemoveUntil(context, routeName!, (route) => false,
arguments: args);
}