addRouter method

dynamic addRouter(
  1. NyRouter router
)

Allows you to add additional Router's to your project.

file: e.g. /lib/routes/account_router.dart NyRouter accountRouter() => nyRoutes((router) { Add your routes here router.route("/account", (context) => AccountPage()); router.route("/account/update", (context) => AccountUpdatePage()); });

Usage in /lib/main.dart e.g. Nylo.addRouter(accountRouter());

Implementation

addRouter(NyRouter router) async {
  if (this.router == null) {
    this.router = NyRouter();
  }
  this.router!.setRegisteredRoutes(router.getRegisteredRoutes());
  NyNavigator.instance.router = this.router!;
}