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