findRouteParamFull method

AFRouteSegment? findRouteParamFull({
  1. required AFScreenID screenId,
  2. required AFWidgetID wid,
  3. required AFRouteLocation routeLocation,
  4. bool includePrior = true,
})

Implementation

AFRouteSegment? findRouteParamFull({
  required AFScreenID screenId,
  required AFWidgetID wid,
  required AFRouteLocation routeLocation,
  bool includePrior = true
}) {
  /// Ugggh.  So, it would be really nice if we could trust the route location here.
  /// However, if you try to chase the routeLocation all the way back to AFConnectedScreen.createContextForDiff, you'll
  /// find that you would need to pass in the routeLocation to the screen constructor.  That requires you to declare
  /// whether the screen's parameter lives in the hierarchy or the global pool when the screen is declared.
  /// I think it is better that it just works this way, where a screen could live in the hierarchy or in the global pool,
  /// depending on where you choose to put the route parameter.
  ///
  /// It is confusing if you have a duplicate screen in both the global pool and the hierarchy, however.
  final globalSeg = globalPool[screenId];

  if(globalSeg != null) {
 if(wid == AFUIWidgetID.useScreenParam) {
      return globalSeg;
    }

    return globalSeg.findChild(wid);
  }

  if(hasStartupWrapper && screenId == AFibF.g.screenMap.startupScreenId) {
    screenId = AFUIScreenID.screenStartupWrapper;
  }

  if(routeLocation == AFRouteLocation.screenHierarchy) {
    return findRouteParamInHierarchy(screenId: screenId, wid: wid, includePrior: includePrior);
  } else {
    return findRouteParamInGlobalPool(screenId: screenId, wid: wid);
  }
}