jump<T extends Object?> method

Future<T?> jump<T extends Object?>(
  1. String route, {
  2. Object? arguments,
})

Requests the wizard to jump to a specific page. Optionally, arguments can be passed to the page.

Implementation

Future<T?> jump<T extends Object?>(String route, {Object? arguments}) async {
  if (!routes.keys.contains(route)) {
    throw WizardException(
        '`Wizard.jump()` called with an unknown route $route.');
  }
  final settings = await _loadRoute(route, (name) async {
    return WizardRouteSettings<T>(name: name, arguments: arguments);
  });

  _updateState((state) {
    final copy = List<WizardRouteSettings>.of(state);
    return copy..add(settings);
  });
  return settings.completer.future;
}