getUnknownRoute static method

NyRouterRoute getUnknownRoute()

Find the unknown route.

Implementation

static NyRouterRoute getUnknownRoute() {
  List<MapEntry<String, NyRouterRoute>> unknownRoutes = NyNavigator
      .instance.router._routeUnknownMappings.entries
      .where((element) => element.value.getUnknownRoute() == true)
      .toList();

  if (unknownRoutes.isNotEmpty && Nylo.user() != null) {
    return unknownRoutes.first.value;
  }

  return NyRouterRoute(
    name: "/404",
    view: (context) => const PageNotFound(),
  );
}