replaceWithNamedRoute method

void replaceWithNamedRoute()

Replaces the current route with a named route.

If a valid BuildContext is provided, this method replaces the current route with the specified named route.

Implementation

void replaceWithNamedRoute() {
  Navigator.pushReplacementNamed(context, routeName!);
}