RootHyperController constructor

RootHyperController({
  1. required RouteValue initialRoute,
  2. required RouteValue? redirect(
    1. BuildContext context,
    2. RedirectState state
    ),
  3. required Map<Object, HyperRoute<RouteValue>> routeMap,
})

Implementation

RootHyperController({
  required RouteValue initialRoute,
  required RouteValue? Function(BuildContext context, RedirectState state)
      redirect,
  required this.routeMap,
}) {
  _redirect = (stack) {
    if (_redirectContext case final context?) {
      if (redirect(context, RedirectState(stack: stack)) case final target?) {
        return createStack(target);
      }
    }

    return stack;
  };

  _stack = createStack(initialRoute);
}