toReplacement<T extends Object?, TO extends Object?> method

Future<T?> toReplacement<T extends Object?, TO extends Object?>(
  1. String routeName, {
  2. TO? result,
  3. Object? arguments,
  4. Map<String, String>? queryParams,
  5. bool fullscreenDialog = false,
  6. bool maintainState = true,
  7. Widget transitionsBuilder(
    1. BuildContext context,
    2. Animation<double> animation,
    3. Animation<double> secondAnimation,
    4. Widget child,
    )?,
})

Find the page with given routeName and remove the current route and replace it with the new one.

It is similar to _navigate.toReplacementNamed method.

Implementation

Future<T?> toReplacement<T extends Object?, TO extends Object?>(
  String routeName, {
  TO? result,
  Object? arguments,
  Map<String, String>? queryParams,
  bool fullscreenDialog = false,
  bool maintainState = true,
  Widget Function(
    BuildContext context,
    Animation<double> animation,
    Animation<double> secondAnimation,
    Widget child,
  )? transitionsBuilder,
}) {
  return _navigationBuilder.toReplacement<T, TO>(
    routeName,
    result: result,
    arguments: arguments,
    queryParams: queryParams,
    fullscreenDialog: fullscreenDialog,
    maintainState: maintainState,
    transitionsBuilder: transitionsBuilder,
  );
}