replace<T extends Object?> method

Future<T?> replace<T extends Object?>({
  1. Object? arguments,
})

Requests the wizard to replace the current page with the next one. Optionally, arguments can be passed to the next page.

Implementation

Future<T?> replace<T extends Object?>({Object? arguments}) async {
  final next = await _loadRoute<T>(currentRoute, (name) {
    return _getNextRoute<T>(name, arguments, routes[name]!.onReplace);
  });

  _updateState((state) {
    final copy = List<WizardRouteSettings>.of(state);
    copy[copy.length - 1] = next;
    return copy;
  });
  return next.completer.future;
}