nestedKey method

GetDelegate? nestedKey(
  1. String? key
)

Implementation

GetDelegate? nestedKey(String? key) {
  // 如果 [key] 为 null, 则返回根导航代理 [rootDelegate]
  if (key == null) {
    return rootDelegate;
  }
  // 如果 [keys] 中不存在对应的 [key], 则创建一个 [GetDelegate] 并放入 [keys] 中
  keys.putIfAbsent(
    key,
    () => GetDelegate(
      showHashOnUrl: true,
      //debugLabel: 'Getx nested key: ${key.toString()}',
      pages: RouteDecoder.fromRoute(key).currentChildren ?? [],
    ),
  );
  // 返回 [key] 对应的 [GetDelegate]
  return keys[key];
}