getPathValues method

Map<String, String> getPathValues(
  1. Request request
)

Get values for path params

Implementation

Map<String, String> getPathValues(Request request) {
  var pathValues = <String, String>{};
  var parts = request.url.path.split('/').where((part) => part.isNotEmpty);

  for (var entry in pathParams.entries) {
    if (entry.value < parts.length) {
      pathValues[entry.key] = parts.elementAt(entry.value);
    }
  }

  return pathValues;
}