initialRoutesGenerate method

List<Route> initialRoutesGenerate(
  1. String name
)

Implementation

List<Route<dynamic>> initialRoutesGenerate(String name) {
  final match = Get.routeTree.matchRoute(name);
  Get.parameters = match?.parameters;

  //Route can be nullable, just pass the unknown route
  if (match?.route == null) {
    return [
      GetPageRoute(
        page: unknownRoute.page,
        parameter: unknownRoute.parameter,
        settings: RouteSettings(name: name, arguments: null),
        curve: unknownRoute.curve,
        opaque: unknownRoute.opaque,
        customTransition: unknownRoute.customTransition,
        binding: unknownRoute.binding,
        bindings: unknownRoute.bindings,
        transitionDuration: (unknownRoute.transitionDuration ??
            Get.defaultTransitionDuration),
        transition: unknownRoute.transition,
        popGesture: unknownRoute.popGesture,
        fullscreenDialog: unknownRoute.fullscreenDialog,
      )
    ];
  }

  return [
    GetPageRoute(
      page: match.route.page,
      parameter: match.route.parameter,
      settings: RouteSettings(name: name, arguments: null),
      curve: match.route.curve,
      opaque: match.route.opaque,
      binding: match.route.binding,
      bindings: match.route.bindings,
      transitionDuration:
          (match.route.transitionDuration ?? Get.defaultTransitionDuration),
      transition: match.route.transition,
      popGesture: match.route.popGesture,
      fullscreenDialog: match.route.fullscreenDialog,
    )
  ];
}