toReplaceNamed function

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

Replace the current route with a named route, optionally passing arguments.

Example:

toReplaceNamed('/newPage', arguments: {'data': data});

Implementation

void toReplaceNamed(String routeName, {Map<String, dynamic>? arguments}) {
  Navigator.of(Utils.navigatorKey.currentContext!)
      .pushReplacementNamed(routeName, arguments: arguments);
}