push<E> method

Future<E?> push<E>(
  1. RouteQuery routeQuery, [
  2. TransitionQuery? transitionQuery
])

Passing routeQuery will take you to a new page.

The method of page transition can be specified with transitionQuery.

You can wait until the page is destroyed by the pop method with the return value Future.

In doing so, it can also receive the object passed by pop.

routeQueryを渡すことにより新しいページに遷移します。

ページ遷移の方法をtransitionQueryで指定可能です。

戻り値のFuturepopメソッドでページが破棄されるまで待つことができます。

また、その際popで渡されたオブジェクトを受け取ることができます。

Implementation

Future<E?> push<E>(
  RouteQuery routeQuery, [
  TransitionQuery? transitionQuery,
]) async {
  final completer = Completer<E?>();
  final resolveQuery = _InnerRouteQueryImpl(
    routeQuery: _context != null
        ? await _redirect(_context!, routeQuery)
        : routeQuery,
    transitionQuery: transitionQuery ?? _config.defaultTransitionQuery,
  );
  _pageStack.add(
    _PageStackContainer<E>(
      query: resolveQuery,
      route: resolveQuery.route<E>(),
      completer: completer,
    ),
  );
  _routerDelegate.notifyListeners();
  return completer.future;
}