AppRouterDelegate constructor

AppRouterDelegate(
  1. HiRouter appRoutePath,
  2. Future<RoutePageInfo> before(
    1. RoutePageInfo pageInfo
    )?,
  3. Widget defaultLoadingPage
)

Implementation

AppRouterDelegate(this.appRoutePath, this.before, this.defaultLoadingPage)
    : navigatorKey = GlobalKey<NavigatorState>() {
  appRoutePath.registerPushCallback((RoutePageInfo pageInfo) {
    if (before != null) {
      before!(pageInfo).then((newPageInfo) {
        pushPageInfo = newPageInfo;
        notifyListeners();
      });
    } else {
      pushPageInfo = pageInfo;
      notifyListeners();
    }
  });
}