getInitialRoute static method

String getInitialRoute()

Find the initial route.

Implementation

static String getInitialRoute() {
  List<MapEntry<String, NyRouterRoute>> authRoutes = NyNavigator
      .instance.router._routeNameMappings.entries
      .where((element) => element.value.getAuthRoute() == true)
      .toList();

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

  List<MapEntry<String, NyRouterRoute>> initialRoutes = NyNavigator
      .instance.router._routeNameMappings.entries
      .where((element) => element.value.getInitialRoute() == true)
      .toList();

  if (initialRoutes.isNotEmpty) {
    return initialRoutes.first.value.name;
  }
  return "/";
}