createParameterResolver static method

ULinkRouteResolver createParameterResolver(
  1. String parameterKey, {
  2. String routePrefix = '',
})

Creates a route resolver that uses parameter-based routing.

parameterKey - The parameter key to use for routing. routePrefix - Optional prefix to add to the route.

Implementation

static ULinkRouteResolver createParameterResolver(
  String parameterKey, {
  String routePrefix = '',
}) {
  return (ULinkResolvedData data) {
    final paramValue = data.parameters?[parameterKey];
    if (paramValue != null) {
      return '$routePrefix/$paramValue';
    }
    return null;
  };
}