initRoute method

void initRoute({
  1. required String? route,
  2. required RixaPage mainPage,
  3. required BuildContext context,
  4. required RixaPage currentPage,
  5. Map<String, String?>? params,
})

Implementation

void initRoute(
    {required String? route,
    required RixaPage mainPage,
    required BuildContext context,
    required RixaPage currentPage,
    Map<String, String?>? params}) {
  _route =
      RouteProperties(route: route, name: currentPage.name, params: params);
  if (pageQue.isNotEmpty && pageQue.last.route == route) {
    pageQue.removeLast();
  }
  _currentPage = currentPage;

  if (kIsWeb && currentPage.description != null) {
    FutureOr<String?> func = currentPage.description!(_route!);
    if (func is Future<String?>) {
      func.then((value) {
        if (_currentPage == currentPage && value != null) {
          _updatePageDescription(value, context);
        }
      });
    } else {
      if (func != null) {
        _updatePageDescription(func, context);
      }
    }
  }
  //routedPageCounts++;
}