getUriProductHelper static method

UriProductHelper getUriProductHelper({
  1. required ProductType? productType,
})

Implementation

static UriProductHelper getUriProductHelper({
  required ProductType? productType,
}) {
  final UriProductHelper currentUriProductHelper = _uriProductHelper;
  if (productType == null) {
    return currentUriProductHelper;
  }
  final ProductType? currentProductType = extractProductType(
    currentUriProductHelper,
  );
  if (currentProductType == null) {
    return currentUriProductHelper;
  }
  if (currentProductType == productType) {
    return currentUriProductHelper;
  }
  return UriProductHelper(
    domain: currentUriProductHelper.domain.replaceFirst(
      currentProductType.getDomain(),
      productType.getDomain(),
    ),
  );
}