toAndClearAllNamedRoute method

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

Navigates to a new route and removes all previous routes from stack.

If a valid BuildContext is provided, this method navigates to the specified named route and removes all previous routes from the navigation stack.

Implementation

void toAndClearAllNamedRoute({String? routeName, Map<String,dynamic>? args}) {
  Navigator.pushNamedAndRemoveUntil(context, routeName!, (route) => true,
      arguments: args);
}