toAndReplaceAllNamedRoute method

void toAndReplaceAllNamedRoute({
  1. String? routeName,
  2. Map<String, dynamic>? args,
})

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);
}