updateRouteParamWithExistingOrDefault method
Implementation
AFRouteState updateRouteParamWithExistingOrDefault(AFRouteParamRef param) {
// first, see if it exists
final seg = this.findRouteParamFull(screenId: param.screenId, routeLocation: param.routeLocation, wid: param.wid);
if(seg != null) {
// it already exists, so nothing to do to the state
return this;
}
final uiConfig = AFibF.g.screenMap.findUIConfig(param.screenId);
// if it doens't already exist, then the UI config must have a way to create a default value.
final create = uiConfig?.createDefaultRouteParam;
if(create == null) {
assert(false, "If you are using AFRouteParamUseExistingOrDefault, and there is no existing value, you must specify a createDefaultRouteParam delegate in our AFConnectedUIConfig declaration.");
return this;
}
final defaultParam = create(param, AFibF.g.internalOnlyActiveStore.state.public);
return updateRouteParam(defaultParam, null, null);
}