replaceWithNamedRoute method

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

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({String? routeName, Map<String,dynamic>? args}) {
  Navigator.pushReplacementNamed(context, routeName!, arguments: args);
}