pushNamed<E> method
Finds a RouteQuery that matches the path
in the list of pages passed to AppRouter.pages and transitions to that 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.
AppRouter.pagesに渡したページリストからpath
に当てはまるRouteQueryを探し出しそちらのページに遷移します。
ページ遷移の方法をtransitionQuery
で指定可能です。
戻り値のFutureでpopメソッドでページが破棄されるまで待つことができます。
また、その際popで渡されたオブジェクトを受け取ることができます。
Implementation
Future<E?> pushNamed<E>(
String path, [
TransitionQuery? transitionQuery,
]) async {
for (final page in pages) {
final resolved = page.resolve(path);
if (resolved != null) {
return push<E>(
resolved,
transitionQuery,
);
}
}
throw Exception("No $path found.");
}