NestedAppRouter constructor

NestedAppRouter({
  1. UnknownRouteQueryBuilder? unknown,
  2. BootRouteQueryBuilder? boot,
  3. String? initialPath,
  4. RouteQuery? initialQuery,
  5. required List<RouteQueryBuilder> pages,
  6. List<RedirectQuery> redirect = const [],
  7. List<NavigatorObserver> observers = const [],
  8. int redirectLimit = 5,
  9. GlobalKey<NavigatorState>? navigatorKey,
  10. String? restorationScopeId,
  11. TransitionQuery? defaultTransitionQuery,
  12. bool reportsRouteUpdateToEngine = true,
  13. Widget backgroundWidget = const Scaffold(),
  14. List<LoggerAdapter> loggerAdapters = const [],
})

Class for creating nested AppRouter.

ネストされたAppRouterを作成するためのクラスです。

Controller to define routing for the entire app.

You can define the routing for the entire app by passing it to routerConfig in MaterialApp.router.

The controller itself can also be manipulated, and page transitions can be performed directly by executing push, replace, and pop.

It is also possible to get the AppRouter object itself with AppRouter.of.

By executing setPathUrlStrategy, it is possible to use URLs with the web hash (#) removed.

Adapters for loggers can be applied to routing in loggerAdapters.

アプリ全体のルーティングを定義するためのコントローラー。

MaterialApp.routerrouterConfigに渡すことでアプリ全体のルーティングを定義することができます。

また、このコントローラー自体を操作することが可能でpushreplacepopを実行することでページ遷移を直接行うことが可能です。

また、AppRouter.ofAppRouterのオブジェクト自体を取得することも可能です。

setPathUrlStrategyを実行することでWebのハッシュ(#)を消したURLを利用することが可能になります。

loggerAdaptersでロガー用のアダプターをルーティングに適用することができます。

final appRouter = AppRouter(
  pages: [
    ListPage.query,
    DetailPage.query,
  ]
);

void main(){
  runApp(
    const MainPage(),
  );
}

class MainPage extends StatelessWidget {
  const MainPage();

  @override
  Widget build(BuilcContext context){
    return MaterialApp.router(
      routerConfig: appRouter,
      title: "Title",
    );
  }
}

Implementation

NestedAppRouter({
  super.unknown,
  super.boot,
  super.initialPath,
  super.initialQuery,
  required super.pages,
  super.redirect = const [],
  super.observers = const [],
  super.redirectLimit = 5,
  super.navigatorKey,
  super.restorationScopeId,
  super.defaultTransitionQuery,
  super.reportsRouteUpdateToEngine = true,
  super.backgroundWidget = const Scaffold(),
  super.loggerAdapters = const [],
}) : super(nested: true);