getAuthRouteName method

String? getAuthRouteName()

Retrieves the auth route name from your router.

Implementation

String? getAuthRouteName() {
  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;
  }
  return null;
}