ShellValue.fromNext constructor

ShellValue.fromNext({
  1. required RouteKey key,
  2. required List<HyperRoute<RouteValue>> tabRoutes,
  3. required RouteNode<RouteValue> next,
})

Implementation

factory ShellValue.fromNext({
  required RouteKey key,
  required List<HyperRoute> tabRoutes,
  required RouteNode next,
}) {
  final tabIndex = tabRoutes.indexWhere((e) => e.key == next.key);

  return ShellValue(
    tabIndex: tabIndex,
    key: key,
    tabNodes: tabRoutes.map((e) {
      if (e.key == next.key) {
        return next;
      }
      return e.createNode();
    }).toList(),
  );
}