NestedAppRouter class

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",
    );
  }
}

Inheritance
Available Extensions

Constructors

NestedAppRouter({UnknownRouteQueryBuilder? unknown, BootRouteQueryBuilder? boot, String? initialPath, RouteQuery? initialQuery, required List<RouteQueryBuilder> pages, List<RedirectQuery> redirect = const [], List<NavigatorObserver> observers = const [], int redirectLimit = 5, GlobalKey<NavigatorState>? navigatorKey, String? restorationScopeId, TransitionQuery? defaultTransitionQuery, bool reportsRouteUpdateToEngine = true, Widget backgroundWidget = const Scaffold(), List<LoggerAdapter> loggerAdapters = const []})
Class for creating nested AppRouter.

Properties

backButtonDispatcher BackButtonDispatcher
The BackButtonDispatcher that is used to configure the Router.
finalinherited
currentQuery RouteQuery?
You can check the current RouteQuery.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
loggerAdapters List<LoggerAdapter>
Adapter to define loggers.
no setterinherited
The navigator that the observer is observing, if any.
no setterinherited
List of NavigatorObserver currently owned by AppRouter.
no setterinherited
pages List<RouteQueryBuilder>
List of pages currently passed to AppRouter.
no setterinherited
routeInformationParser RouteInformationParser<RouteQuery>
The RouteInformationParser that is used to configure the Router.
no setterinherited
routeInformationProvider RouteInformationProvider?
The RouteInformationProvider that is used to configure the Router.
no setterinherited
routerDelegate RouterDelegate<RouteQuery>
The RouterDelegate that is used to configure the Router.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
canPop() bool
Checks if the page is pop-able. If true is returned, the page is popable.
inherited
clear() → void
Clears all router pages and returns to the startup state.
inherited
didPop(Route route, Route? previousRoute) → void
The Navigator popped route.
inherited
didPush(Route route, Route? previousRoute) → void
The Navigator pushed route.
inherited
didRemove(Route route, Route? previousRoute) → void
The Navigator removed route.
inherited
didReplace({Route? newRoute, Route? oldRoute}) → void
The Navigator replaced oldRoute with newRoute.
inherited
didStartUserGesture(Route route, Route? previousRoute) → void
The Navigator's routes are being moved by a user gesture.
inherited
didStopUserGesture() → void
User gesture is no longer controlling the Navigator.
inherited
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
pop<E>([E? result]) → void
Discards the current page and returns to the previous page.
inherited
popUntil<E>(bool predicate(RouteQuery query), [E? result]) → void
Keep pop until the predicate condition is true.
inherited
push<E>(RouteQuery routeQuery, [TransitionQuery? transitionQuery]) Future<E?>
Passing routeQuery will take you to a new page.
inherited
pushNamed<E>(String path, [TransitionQuery? transitionQuery]) Future<E?>
Finds a RouteQuery that matches the path in the list of pages passed to AppRouter.pages and transitions to that page.
inherited
refresh() → void
Refresh the current page.
inherited
registerPage(RouteQueryBuilder pageBuilder) → void
Register a new RouteQueryBuilder.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
replace<E>(RouteQuery routeQuery, [TransitionQuery? transitionQuery]) Future<E?>
Passing routeQuery replaces the currently displayed page with a new page.
inherited
replaceNamed<E>(String path, [TransitionQuery? transitionQuery]) Future<E?>
Finds a RouteQuery that matches the path in the list of pages passed to AppRouter.pages and replaces the currently displayed page with that page.
inherited
reset<E>([E? result]) → void
Continue to pop until the history stack runs out.
inherited
resetAndPush<E>(RouteQuery routeQuery, [TransitionQuery? transitionQuery]) Future<E?>
Keep pop until the history stack runs out, then push routeQuery.
inherited
resetAndPushNamed<E>(String path, [TransitionQuery? transitionQuery]) Future<E?>
Continue pop until the history stack runs out, then push to the RouteQuery that applies to path.
inherited
toString() String
A string representation of this object.
inherited
unregisterPage(RouteQueryBuilder pageBuilder) → void
Unregister the RouteQueryBuilder.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited